/* --- PODCUBE EXPLORER STYLES (COMPREHENSIVE EDITION) --- */
:root {
    --primary: #1768da;
    --primary-dim: #e1e8f3;
    --primary-dark: #0d4da1;
    --bg-body: #fdfdfc;
    --bg-panel: #ffffff;
    --text-main: #1a1a1a;
    --text-muted: #555555;
    --border: #1768da;
    --success: #1768da;
    --warning: #1768da;
    --danger: #ff4444;
    --code-bg: #1768da;
    --code-text: #ffffff;
    --orange: #f18701;
    
    --monitor-height: 40px;
    --transport-height: 80px;

    border-radius: 0px!important;
    touch-action: manipulation;
}

* { margin: 0; padding: 0; box-sizing: border-box; 

    scrollbar-color: var(--primary-dark) var(--primary-dim);
    scrollbar-width: thin;
}

.icon-svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    display: block;
}

html, body {
    overscroll-behavior-x: none;
    touch-action: pan-y;
}

body {
    font-family: "Libertinus Math", serif;
    background: var(--bg-body);
    color: var(--text-main);
    padding: 30px 40px calc(var(--transport-height) + var(--monitor-height) + 20px + env(safe-area-inset-bottom, 0px)) 40px;
    
    /* GLOBAL SCROLL: Allow the window to handle scrolling */
    min-height: 100vh;
    height: auto;
    overflow-y: auto; /* Force scrollbar to prevent layout shift */
    display: block;     /* Remove flex column constraint */
    max-width: 950px;
    margin:auto;
    border: 1px solid var(--primary-dim);

}

header {
    flex: 0 0 auto;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px double var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-body); /* Ensure opacity */
}

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4, .ep-title { 
    font-family: "Libertinus Math", serif; 
    font-weight: 700; 
    margin-bottom: 5px;
}

.label, button, .tab-button { 
    font-family: "Fustat", sans-serif; 
}


/* --- HEADER --- */
header {
    flex: 0 0 auto;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px double var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    width: 70px;
    height: 70px;
    object-fit: contain;
    margin-right: 15px;
    background: #fff;
}

h1 { 
    font-size: 2em;
    letter-spacing: -0.02em; 
    color: var(--primary); 
}

.subtitle { 
    font-family: "Fustat"; 
    font-size: 10px; 
    text-transform: uppercase; 
    letter-spacing: 0.1em; 
    color: #666; 
}

/* --- TABS --- */ 

.sticky-top {
    display: contents;
    position: relative;
    background: var(--bg-body);
    z-index: 12;
    padding-top: 0px;
    padding-bottom: 0px;
}

.tabs {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-body);

    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    flex-wrap: nowrap;
    margin: 0 -8px 20px -8px;
    /* Bleed to edges */
    padding: 5px 15px 5px 15px;
    border-bottom: 1px solid var(--primary);
    max-width:950px;
    /* Hide scrollbars */
    -ms-overflow-style: none;
    scrollbar-width: none;
}


.tab-button {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid var(--text-muted);
    border-bottom: none;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #888;
    
    transition: all 0.15s ease;
}

@media (hover: hover){
.tab-button:hover { 
    color: var(--primary); 
    background: #f5f5f5; 
}}

.tab-button.active {
    color: var(--primary);
    background: #fff;
    border-color: var(--primary);
    
    /* THE FIX: Solid white bottom border to mask the container line */
    border-bottom: 1px solid #fff;
    
    /* Push the tab down 1px to overlap the line */
    position: relative;
    top: 1px;
    
    /* Ensure it sits above the container's border */
    z-index: 2;
}

/* --- CONTENT AREA (SCROLLABLE) --- */

.filter-toggle-cb, .filter-toggle-btn {
    display: none;

}

.tab-content {
    display: none;
    flex: 1;
    overflow: visible;
    padding-right: 5px;
}

.tab-content.active { 
    display: block;
    flex-direction: column;
    margin-top:15px;
}

.section {
    margin-bottom: 30px;
}

.section:last-child {
    margin-bottom: 0;
}

.section-subtitle {
    font-size: 1.1em;
    margin-bottom: 12px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- ARCHIVE REGISTRY LAYOUT --- */
.registry-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.registry-sidebar {
    background: #f8f8f8;
    border: 1px solid var(--primary);
    padding: 15px;
    overflow-y: auto;
    max-height:fit-content;
    
}

.registry-results {
    overflow-y: auto;
    padding-right: 10px;
    display: flex;
    flex-direction: column;
}

/* --- EPISODE CARDS --- */
.ep-card {
    display: flex;
    background: #fff;
    border: 1px solid var(--primary);
    margin-bottom: 10px;
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    align-items:center;
}

@media (hover: hover){
.ep-card:hover {
    border-color: var(--primary);
    transform: translateX(3px);
    box-shadow: 3px 3px 0 rgba(23, 104, 218, 0.1);
}}

.ep-card.selected {
    border-color: var(--primary);
    background: var(--primary-dim);
    box-shadow: 0 0 0 2px var(--primary);
}

.btn-queue.selected {
    background-color: var(--primary-dark);
    color: var(--primary-dim);
}

.ep-status-strip {
    width: 6px;
    background: #eee;
    flex-shrink: 0;
}

.ep-card.playing .ep-status-strip { 
    background: var(--primary);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ep-content { 
    padding: 12px 15px; 
    flex: 1; 
    min-width: 0; 
}

.ep-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: baseline; 
    margin-bottom: 5px; 
    gap: 10px;
}

.ep-title { 
    font-size: 0.8em; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    flex: 1;
}

.ep-date { 
    font-family: "Fustat", sans-serif; 
    font-size: 10px; 
    font-weight: bold;
    color: #888; 
    white-space: nowrap; 
}

.ep-duration{
    margin-left: auto;
    font-family: "Fustat", sans-serif;
}

.ep-meta-row { 
    display: flex; 
    gap: 10px; 
    font-size: 11px; 
    color: #555; 
    margin-bottom: 4px; 
    align-items: center;
    
}

.ep-tag { 
    background: #eee; 
    padding: 2px 6px; 
     
    font-size: 10px; 
    font-family: "Fustat";
    text-transform: uppercase;
    font-weight: 600;
}

.ep-location {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    display: block;
    margin-bottom: 4px;
}

.ep-played-icon {
    display: none;
    color: var(--success);
    font-size: 14px;
    margin-right: 6px;
    vertical-align: baseline;
}
.ep-card.is-played .ep-played-icon,
.related-ep-card.is-played .ep-played-icon {
    display: inline-block;
}

/* Integrity Bar */
.integrity-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    width: 100%; /* Ensure it spans the full width */
}

.integrity-text {
    font-size: 9px;
    font-family: "Fustat";
    font-weight: 700;
    color: #888;
    min-width: 30px;
    flex-shrink: 0;
}

/* New styling for the relocated duration */
.integrity-wrapper .ep-duration {
    margin-left: auto; /* Pushes the duration to the far right */
    font-family: "Fustat";
    font-size: 9px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
}

.integrity-container {
    height: 4px;
    background: #f0f0f0;
    width: 100%;
    overflow: hidden;
}

.integrity-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s ease;
}

.ep-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px;
    border-left: 1px solid #f0f0f0;
    gap: 5px;
    background: #fafafa;
}

.icon-btn {
    border: 1px solid var(--primary);
    background: #fff;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 10px;
    text-transform: uppercase;
    font-family: "Fustat";
    font-weight: 600;
    transition: all 0.15s ease;
    
}

@media (hover: hover){
.icon-btn:hover { 
    border-color: var(--primary); 
    color: var(--primary); 
    background: var(--primary-dim);
}
}
.icon-btn:active {
    transform: scale(0.95);
}

.reset-btn{
    background: var(--primary-dark);
    color: var(--bg-panel);
    width:100%;
}



/* --- INSPECTOR STYLES --- */
.inspector-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

/* New Inspector Header Card */
.inspector-header-card {
    background: #fff;
    border: 3px double var(--primary);
    padding: 25px;
    margin-bottom: 20px;
    margin-top:10px;
    position: relative;
}

.inspector-header-card::before {
    content: "Transmission Report";
    position: absolute;
    top: -10px;
    left: 15px;
    background: var(--bg-body);
    padding: 0 10px;
    font-family: "Fustat", sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}

.inspector-empty-state {
    text-align: center;
    padding: 20px;
    color: #888;
}

.inspector-empty-state h3 {
    margin-bottom: 10px;
    color: var(--text-main);
}

/* Loaded State - Summary Card */
.inspector-summary {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.inspector-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    flex-wrap: wrap;
}

.inspector-title {
    font-size: 1.8em;
    color: var(--primary);
    line-height: 1.2;
    flex: 1;
    min-width: 200px;
}

.inspector-summary-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.inspector-summary-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.inspector-meta-line {
    font-family: "Fustat";
    font-size: 11px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.inspector-meta-line .label {
    text-transform: uppercase;
    font-weight: 700;
    color: #999;
    font-size: 9px;
    letter-spacing: 0.05em;
}

.inspector-meta-line .value {
    color: var(--text-main);
    font-weight: 600;
    text-transform:uppercase;
}

.inspector-meta-line .separator {
    color: #ccc;
}

.inspector-action-btn {
    border: 1px solid var(--primary);
    background: #fff;
    color: var(--primary);
    padding: 8px 16px;
    font-family: "Fustat";
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

@media (hover: hover) {
    .inspector-action-btn:hover {
        background: var(--primary);
        color: #fff;
    }

    .inspector-action-btn.primary:hover {
        background: var(--primary-dark);
    }
    
}

.inspector-action-btn.primary {
    background: var(--primary);
    color: #fff;
}
/* Report Body */
.inspector-report-body {
    display: none;
}

.inspector-report-body.loaded {
    display: block;
}

.inspector-section {
    margin-bottom: 25px;
}

.inspector-section-title {
    letter-spacing: 0.05em;
    color: var(--text);
    font-family: "Libertinus Math";
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}

/* Prose Style Content */
.inspector-prose {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-main);
}

.inspector-prose p {
    margin-bottom: 12px;
}

.inspector-prose strong {
    font-weight: 500;
}

.inspector-prose .code-inline {
    font-family: "Fustat";
    font-size: 12px;
    background: #f5f5f5;
    padding: 2px 6px;
    color: var(--text-main);
    font-weight: 600;
}

/* Callout Boxes - for important info */
.inspector-callout {
    margin: 15px 0;
    font-size: 13px;
}

.inspector-callout-title {
    font-family: "Fustat";
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    color: #999;
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}

.inspector-callout-content {
    color: var(--text-main);
    line-height: 1.5;
}

/* Data Grid - for structured lists */
.inspector-data-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 20px;
    font-size: 13px;
    margin: 15px 0;
    padding: 0;
}

.inspector-data-grid .data-label {
    font-family: "Fustat";
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: #888;
}

.inspector-data-grid .data-value {
    color: var(--text-main);
    font-weight: 500;
}

.inspector-data-grid .data-value.code {
    font-family: "Fustat";
    font-size: 12px;
    font-weight: 600;
}

/* Tag Pills */
.inspector-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0;
}

.inspector-tag-pill {
    background: var(--primary-dim);
    color: var(--primary-dark);
    padding: 5px 12px;
    font-size: 11px;
    font-family: "Fustat";
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover){
.inspector-tag-pill:hover {
    background: var(--primary);
    color: #fff;
}}

/* Related Episodes - Compact List */
.inspector-related-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.inspector-related-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover){
.inspector-related-item:hover {
    background: var(--primary-dim);
}}

.inspector-related-item-info {
    flex: 1;
    min-width: 0;
}

.inspector-related-item-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inspector-related-item-meta {
    font-size: 10px;
    color: #777;
    font-family: "Fustat";
}

.inspector-related-item-arrow {
    color: var(--primary);
    font-weight: 700;
    margin-left: 10px;
}

/* Description Block */
.inspector-description-block {
    padding: 0;
    font-size: 14px;
    line-height: 1.7;
    color: #555;
    max-height: 400px;
    overflow-y: auto;
    margin: 15px 0;
}

.inspector-description-block:empty::before {
    content: "No description available";
    color: #999;
    font-style: italic;
}

/* Legacy Grid Styles - Keep for compatibility */
.inspector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.doubleborder {
    border: 3px double var(--primary); 
    padding: 15px 12px 12px 12px;
    margin-top: 10px;
    position:relative;
    max-width:fit-content;
    margin-left:auto;
    margin-right:auto;
}

.doubleborder::after {
    /* Grabs the text from the HTML attribute */
    content: attr(data-label); 
    
    position: absolute;
    top: -8px; /* Offset to sit on the border */
    left: 10px;
    
    background: #fff; /* Masks the border behind the text */
    padding: 0 6px;
    
    /* Typography matches your Hero style */
    font-family: "Fustat", sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.inspector-field {
    border: 3px double var(--primary); 
    padding: 15px 12px 12px 12px;
    margin-top: 10px;
    position:relative;
    width:100%;
    max-width:100%;
    
}


.inspector-field-value, .inspector-field-value.code {
    font-family: "Fustat";
    font-size: 12px;
    background: #f5f5f5;
    padding: 4px 6px;
    
}

.inspector-field-value.empty {
    color: #999;
    font-style: italic;
}

.inspector-code-block {
    background: var(--code-bg);
    color: var(--code-text);
    font-family: monospace;
    font-size: 11px;
    padding: 15px;
    
    overflow-x: auto;
    max-height: 450px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
}

.inspector-code-block.live-updating {
    animation: updateFlash 0.3s ease;
}

@keyframes updateFlash {
    0%, 100% { background: var(--code-bg); }
    50% { background: #2a2a2a; }
}

.inspector-description {
    background: #fff;
    border: 1px solid var(--primary);
    padding: 15px;
    font-size: 13px;
    line-height: 1.6;
    color: #555;
    
    max-height: 300px;
    overflow-y: auto;
}

.inspector-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.inspector-tag {
    background: var(--primary-dim);
    color: var(--primary-dark);
    padding: 4px 10px;
    
    font-size: 11px;
    font-family: "Fustat";
    font-weight: 600;
}

/* --- DATA TABS --- */
.data-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.data-tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--primary);
    border-bottom: none;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    font-family: "Fustat";
    color: #888;
    transition: all 0.15s ease;
}

@media (hover: hover){
.data-tab-btn:hover {
    color: var(--primary);
    background: #f5f5f5;
}}

.data-tab-btn.active {
    color: var(--primary);
    background: #fff;
    border-color: #ddd;
    border-bottom-color: #fff;
    margin-bottom: -1px;
}

.data-panel {
    display: none;
}

.data-panel.active {
    display: block;
}
/* ========== PLAYBACK CONTROL PANEL ========== */

/* Now Playing Card (keeps double border) */
.player-now-playing-card {
    background: #fff;
    border: 3px double var(--primary);
    padding: 25px;
    margin-bottom: 20px;
    margin-top:10px;
    position: relative;
}

.player-now-playing-card::before {
    content: "Playback Engine";
    position: absolute;
    top: -10px;
    left: 15px;
    background: var(--bg-body);
    padding: 0 10px;
    font-family: "Fustat", sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}

.player-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.player-card-label {
    font-family: "Fustat";
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    color: #999;
    letter-spacing: 0.05em;
}

.player-card-time {
    font-family: "Fustat";
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
}

.time-separator {
    margin: 0 4px;
    color: #ccc;
}

.player-card-title {
    font-size: 1.8em;
    color: var(--primary);
    margin-bottom: 6px;
    line-height: 1.2;
}

.player-card-meta {
    font-family: "Fustat";
    font-size: 12px;
    color: #666;
    margin-bottom: 20px;
}

.player-scrubber-wrapper {
    margin-bottom: 20px;
}

.player-transport-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap; /* Allows wrapping on mobile */
}



.player-transport-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.player-transport-btn {
    width: 50px;
    height: 50px;
    border: 1px solid var(--primary);
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

@media (hover: hover){
.player-transport-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: scale(1.05);
}
.player-transport-btn-play:hover {
    background: var(--primary-dark);
}}

.player-transport-btn-play {
    width: 60px;
    background: var(--primary);
    color: #fff;
}



.player-transport-main-group {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

/* Radio section alignment */
.player-radio-section {
    padding: 5px 15px;
    background: var(--primary-dim);
    border-right: 3px double var(--primary);

}

/* Mobile logic: Force the Radio Mode to a new row */
@media (max-width: 768px) {
    .player-transport-row {
        flex-direction: column; /* Stack the groups vertically */
        gap: 15px;
    }

    .player-transport-main-group {
        width: 100%;
        justify-content: flex-start; /* Buttons fill the width on mobile */
    }

}

.player-settings-bar {
    display: flex;
    gap: 30px;
    justify-content: space-between;
    align-items: center;
}

.player-setting-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-setting-label {
    font-family: "Fustat";
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: #888;
    min-width: 50px;
    margin-bottom: 0;
}

.player-setting-slider {
    width: 120px;
}

.player-setting-value {
    font-family: "Fustat";
    font-size: 11px;
    font-weight: 600;
    color: var(--text-main);
    min-width: 40px;
}

.player-setting-select {
    padding: 4px 8px;
    font-family: "Fustat";
    font-size: 11px;
    border: 1px solid #ddd;
    background: #fff;
    margin-bottom: 0;
}

/* Queue Section (brigistics-style, no double border wrapper) */
.player-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    padding-bottom: 10px;
    border-bottom: 3px double var(--primary);
    flex-wrap: wrap;
    gap: 10px;
}

.player-section-header h3 {
    margin: 0;
}

.player-queue-actions {
    display: flex;
    gap: 8px;
}

.player-queue-btn {
    border: 1px solid var(--primary);
    background: #fff;
    color: var(--primary);
    padding: 6px 14px;
    font-family: "Fustat";
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover){
.player-queue-btn:hover {
    background: var(--primary);
    color: #fff;
}}

.player-queue-stats-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    font-family: "Fustat";
    font-size: 11px;
    color: #666;
    padding: 12px 0;
    margin-bottom: 0;
}

.queue-stat-item {
    font-weight: 600;
}

.queue-stat-separator {
    color: #ccc;
}

.player-queue-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
    background: #fff;
}

.player-queue-list:empty::before {
    content: "Queue is empty — add transmissions from the Browse tab or activate Radio Mode";
    display: block;
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-style: italic;
    font-size: 14px;
}

.player-radio-section {
    padding: 5px 15px;
    background: var(--primary-dim);
    border-right: 3px double var(--primary);
    margin-left: auto;
}

.player-radio-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.player-radio-toggle input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--orange);
}

.player-radio-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player-radio-label strong {
    font-family: "Fustat";
    font-size: 12px;
    color: var(--text-main);
}

.player-radio-desc {
    font-family: "Fustat";
    font-size: 10px;
    color: #666;
}

/* Section Titles */
.player-section-title {
    font-size: 1em;
    color: var(--text-main);
    font-family: "Libertinus Math", serif;
    font-weight: 700;
    margin-bottom: 0;
    padding-bottom: 10px;
    border-bottom: 3px double var(--primary);
}

/* Playlist Controls */
.player-playlist-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    margin-bottom: 15px;
    padding: 12px 0;
}

.player-playlist-input {
    flex: 1;
    margin: 0;
    padding: 8px 12px;
    font-family: "Fustat";
    font-size: 12px;
    border: 1px solid #ddd;
}

/* Audio Diagnostics (visible, integrated into document flow) */
.player-diagnostic-prose {
    font-size: 13px;
    line-height: 1.6;
    color: #666;
    margin-bottom: 15px;
    margin-top: 10px;
}

.player-diagnostic-prose p {
    margin: 0;
}

.player-diagnostic-callout {
    padding: 0;
    margin-bottom: 20px;
}

.player-diagnostic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.player-diagnostic-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
}

.player-diagnostic-label {
    font-family: "Fustat";
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    color: #888;
}

.player-diagnostic-value {
    font-family: "Fustat";
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.player-live-data-title {
    font-family: "Fustat";
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: #888;
    margin-bottom: 10px;
    margin-top: 20px;
}

/* Legacy Playback Control Panel (keep for compatibility) */
.playback-control-panel {
    background: #fff;
    border: 3px double var(--primary);
    padding: 25px;
    margin-top: 10px;
    margin-bottom: 20px;
    position: relative;
}

/* Document annotation label */
.playback-control-panel::before {
    content: "Primary Controls";
    position: absolute;
    top: -8px;
    left: 15px;
    background: var(--bg-body);
    padding: 0 8px;
    font-family: "Fustat", sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========== PLAYBACK BAR (BUTTON ROW) ========== */
.playback-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    padding: 0;
    background: transparent;
    border: none;
}

/* Control buttons styling */
.control-btn {
    width: 60px;
    height: 60px;
    border: 2px solid var(--primary);
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

@media (hover: hover){
.control-btn:hover {
    background: var(--primary-dim);
    transform: scale(1.08);
}}

.control-btn:active {
    transform: scale(0.95);
}

/* Play button special styling */
.control-btn-large.control-btn-play {
    width: 90px;
    height: 90px;
    border: 3px solid var(--primary);
    background: var(--primary);
    color: #fff;
    font-size: 32px;
}

@media (hover: hover){
.control-btn-large.control-btn-play:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}}

/* Remove separator */
.bar-separator {
    display: none;
}

/* Input groups (volume, rate) */
.bar-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f8f8;
    border: 1px solid var(--primary-dim);
    padding: 8px 12px;
    flex-shrink: 0;
}

.bar-input-group label {
    font-size: 10px;
    font-weight: 700;
    color: #666;
    margin: 0;
    text-transform: uppercase;
    white-space: nowrap;
}

.bar-input-group input {
    width: 150px;
    margin: 0;
    padding: 4px;
}

.bar-input-group select {
    padding: 4px 6px;
    margin: 0;
    width: auto;
    font-size: 11px;
}

/* ========== PLAYBACK SCRUBBER & TIME ========== */
.playback-scrubber-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: #f8f8f8;
    border: 1px solid var(--primary-dim);
    margin-top: 20px;
}

.playback-time {
    font-family: "Fustat";
    font-size: 13px;
    font-weight: 700;
    color: #666;
    min-width: 45px;
    text-align: center;
    text-transform: uppercase;
}

.playback-scrubber {
    flex: 1;
    height: 6px;
    background: #e8e8e8;
    cursor: pointer;
    position: relative;
    overflow: visible;
    border: 1px solid var(--primary-dim);
    touch-action: none;
}

.playback-scrubber-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.1s linear;
    position: relative;
}

.playback-scrubber-handle {
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: 0 2px 4px rgba(23, 104, 218, 0.25);
    opacity: 0;
    transition: opacity 0.2s ease;
}

@media (hover: hover){
.playback-scrubber:hover .playback-scrubber-handle {
    opacity: 1;
}
}
/* ========== QUEUE MANAGEMENT SECTION ========== */
/* Queue stats styling (legacy) */
.queue-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.badge {
    display: inline-block;
    padding: 6px 10px;
    font-size: 10px;
    font-family: "Fustat";
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border: 1px solid var(--primary);
    background: #fff;
    color: var(--primary);
}

.badge-info {
    background: var(--primary-dim);
    border-color: var(--primary);
    color: var(--primary-dark);
}

/* Queue list container */
#playerQueueList {
    border: 1px solid var(--primary-dim);
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    margin-left: 15px;
    background: #fff;
}

.queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
    transition: all 0.15s ease;
    gap: 12px;
}

.queue-item:last-child {
    border-bottom: none;
}

@media (hover: hover){
.queue-item:hover {
    background: var(--primary-dim);
}}

.queue-item.current {
    background: var(--primary-dim);
    border-left: 3px solid var(--primary);
    padding-left: 9px;
}

.queue-item-number {
    font-weight: 700;
    color: var(--primary);
    font-family: "Fustat";
    font-size: 11px;
    min-width: 25px;
    text-align: center;
}

.queue-item-info {
    flex: 1;
    min-width: 0;
}

.queue-item-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.queue-item-meta {
    font-size: 10px;
    color: #888;
    font-family: "Fustat";
}

.queue-item-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.queue-item-actions button {
    width: auto;
    height: 24px;

    padding: 0 5px;
    border: 1px solid var(--primary);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.15s ease;
}

@media (hover: hover){
.queue-item-actions button:hover {
    background: var(--primary);
    color: #fff;
}
}


/* ========== PLAYLISTS SECTION ========== */

.playlist-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    background: transparent;
    padding: 0;
    border: none;
}

.playlist-controls input {
    flex: 1;
    margin-bottom: 0;
    padding: 8px 10px;
    border: 1px solid var(--primary);
}

.playlist-controls button {
    margin-bottom: 0;
}

.playlist-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 400px));
    gap: 15px;
    margin-top:10px;
    
    filter: drop-shadow(4px 4px 3px rgba(0,0,0,0.2)); 
}

/* When empty, switch to block layout to fill width */
.playlist-list.empty {
    display: block;
}

.playlist-card {
    border: 3px double var(--primary);
    background: #fff;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.1s ease;
}

@media (hover: hover){
.playlist-card:hover {
    transform: translateY(-2px);
    background: var(--primary-dim);
}
}
.mini-qr-container {
    width: 100px;
    height: 100px;
    background: #fff;
    border: 1px solid var(--primary);
    margin: 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.playlist-card .playlist-name {
    font-size: 14px;
    height: 34px; /* Limits to ~2 lines */
    overflow: hidden;
    margin-bottom: 4px;
}

.playlist-card .playlist-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    width: 100%;
}

/* Empty state for playlists */
.playlist-empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 12px;
    background: #f8f8f8;
    border: 1px dashed var(--primary-dim);
    font-family: "Fustat";
}

.playlist-import-controls {
    background: #f0f4f8;
    border: 1px solid #d1d9e6;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.playlist-import-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.playlist-import-row input {
    margin-bottom: 0;
    background: #fff;
    font-family: monospace;
    font-size: 11px;
}

/* --- PUNCHCARD READER (New & Clean) --- */
.punchcard-reader-wrapper {
    background: var(--primary-dim);
    border: 3px double var(--primary);
    padding: 15px;
    margin-bottom: 20px;
    position: relative;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

/* Drag & Drop Hover State */
.punchcard-reader-wrapper.drag-active {
    background: #fff;
    box-shadow: 0 0 15px var(--primary);
    border-color: var(--primary-dark);
}

.punchcard-reader-wrapper.drag-active::after {
    content: "DROP PUNCHCARD IMAGE HERE";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(23, 104, 218, 0.9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Fustat", sans-serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.1em;
    z-index: 10;
    pointer-events: none;
}

.punchcard-label {
    margin-bottom: 8px; 
    display: block; 
    font-weight: 700; 
    letter-spacing: 0.05em; 
    color: var(--primary-dark);
}

.punchcard-row {
    display: flex; 
    gap: 10px; 
    margin-bottom: 15px;
    justify-content: space-between;
}

.punchcard-row:last-child {
    margin-bottom: 0;
}

.punchcard-input {
    margin: 0; 
    flex: 1; 
    font-family: monospace; 
    border: 1px solid var(--primary);
    background: #fff;
}

.punchcard-btn {
    background: var(--primary); 
    color: white; 
    padding: 0 20px;
    border: 1px solid var(--primary);
    font-family: "Fustat", sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover){
.punchcard-btn:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}
}
.punchcard-issue-btn {
    /* Styles for the "Issue" button specifically if needed, inheriting from above */
    background: #fff;
    color: var(--primary);
}

@media (hover: hover){
.punchcard-issue-btn:hover {
    background: var(--primary);
    color: #fff;
}}

/* Responsive adjustments */
@media (max-width: 768px) {
    .punchcard-row {
        flex-direction: column;
        gap: 8px;
    }

    .punchcard-btn{
        padding: 10px;
    }

    .punchcard-btn-clr{
        padding: 0px;
        padding-left: 5px;
        padding-right: 5px;
    }
    .punchcard-row.punchcard-top-row{
        flex-direction: row;
    }
}

/* ========== BUFFER & AUDIO STATE SECTION ========== */

/* Status grid boxes */


.stat-box {
    border: 1px solid var(--primary);
    padding: 15px;
    background: #fff;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.stat-box label {
    font-size: 10px;
    text-transform: uppercase;
    color: #777;
    margin-bottom: 8px;
    font-weight: 700;
}

.stat-num {
    font-size: 1.6em;
    color: var(--primary);
    font-family: "Libertinus Math";
    font-weight: 700;
    margin: 0;
}

/* ========== LIVE PLAYBACK DATA SECTION ========== */

.live-data-container {
    position: relative;
    background: var(--code-bg);
    border: 1px solid #333;
}

.live-data-container::before {
    content: "● LIVE";
    position: absolute;
    top: 8px;
    right: 12px;
    color: #ff4444;
    font-size: 9px;
    font-weight: 700;
    font-family: "Fustat";
    z-index: 10;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#livePlaybackData {
    background: var(--code-bg);
    color: var(--code-text);
    font-family: monospace;
    font-size: 11px;
    padding: 15px;
    max-height: 350px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
    margin: 0;
}

/* ========== RESPONSIVE ADJUSTMENTS ========== */
@media (max-width: 768px) {
    .playback-bar {
        gap: 8px;
    }

    .control-btn {
        width: 50px;
        height: 50px;
    }

    .control-btn-large.control-btn-play {
        width: 70px;
        height: 70px;
        font-size: 24px;
    }

    .bar-input-group {
        flex-direction: column;
        gap: 4px;
    }

    .bar-input-group input {
        width: 100px;
    }

    .playback-scrubber-container {
        flex-wrap: wrap;
        gap: 8px;
    }

    

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .radio-btn {
        align-items: center;
        justify-content: flex-end;
    }
}

/* --- RELATED EPISODES --- */
.related-ep-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--primary);
    margin-bottom: 8px;
    
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover){
.related-ep-card:hover {
    border-color: var(--primary);
    background: var(--primary-dim);
    transform: translateX(2px);
}}

.related-ep-info {
    flex: 1;
    min-width: 0;
}

.related-ep-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.related-ep-meta {
    font-size: 10px;
    color: #777;
    font-family: "Fustat";
}

.related-ep-score {
    font-size: 11px;
    color: var(--primary);
    font-weight: 700;
    font-family: "Fustat";
    margin-left: 10px;
}

/* --- CONTROLS --- */
input, select {
    width: 100%;
    padding: 7px;
    margin-bottom: 12px;
    border: 1px solid var(--primary-dark);
    font-family: "Libertinus Math", serif;
    font-size: 12px;
    
    transition: border-color 0.15s ease;
}

input[type="range"] {
    -webkit-appearance: none; /* Remove default browser styling */
    appearance: none;
    border: none;             /* Remove the border inherited from generic input */
    padding: 0;               /* Remove padding inherited from generic input */
    background: var(--text-muted);
    height: 4px;              /* Thin track */
    margin: 10px 0;           /* Give it breathing room */
    cursor: pointer;
    
    /* THE MAGIC FIX: This sets the thumb and filled track color */
    accent-color: var(--primary); 
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-dim);
}

label { 
    display: block; 
    font-size: 10px; 
    text-transform: uppercase; 
    color: #777; 
    margin-bottom: 4px; 
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* --- GLOBAL TRANSPORT --- */
.global-transport {
    position: fixed;
    bottom: calc(var(--monitor-height) + env(safe-area-inset-bottom, 0px));
    left: 0; 
    right: 0;
    height: var(--transport-height);
    background: #fff;
    border-top: 3px double var(--primary);
    border-left: 1px solid var(--primary-dim);
    border-right: 1px solid var(--primary-dim);
    display: flex;
    flex-direction: column;
    padding: 12px 30px;
    z-index: 100;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 950px;
    margin: 0 auto;
}

.transport-toggle-btn {
    display: none;
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 15px;
    background: #fff;
    border: 1px solid var(--primary);
    border-bottom: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 101;
    color: var(--primary);
}

.transport-toggle-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

/* Rotate chevron when expanded */
.global-transport.expanded .transport-toggle-btn svg {
    transform: rotate(180deg);
}

.transport-main { 
    display: flex; 
    align-items: center; 
    gap: 15px;
    margin-bottom: 10px;
}

.transport-info { 
    min-width: 0; 
    flex: 1;
}

.transport-title { 
    font-weight: 700; 
    color: var(--primary); 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    font-size: 14px;
    margin-bottom: 2px;
}

.transport-controls {
    display: flex;
    gap: 20px;
    align-items: center;
}

.transport-control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.transport-label {
    font-size: 14px;
}

.transport-select {
    padding: 4px 8px;
    margin: 0;
    font-size: 11px;
    min-width: 80px;
}

.transport-slider {
    width: 120px;
    margin: 0;
}

.transport-value {
    font-family: "Fustat";
    font-size: 11px;
    font-weight: 600;
    color: #666;
    min-width: 40px;
}

.control-btn {
    width: 45px; 
    height: 30px;
    border: 1px solid var(--primary);
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.control-btn.control-btn-play {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

@media (hover: hover){
.control-btn:hover { 
    background: var(--primary); 
    color: #fff; 
    border-color: var(--primary); 
    transform: scale(1.05);
}

.control-btn.control-btn-play:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}}

.control-btn:active {
    transform: scale(0.95);
}

.scrubber { 
    flex: 1; 
    height: 6px; 
    background: #e0e0e0; 
    cursor: pointer; 
    position: relative; 
    overflow: hidden;
    touch-action: none;
}

.scrubber-fill { 
    height: 100%; 
    background: var(--orange); 
    width: 0%; 
    transition: width 0.1s linear;
}

/* --- CODE MONITOR --- */
.code-monitor {
    position: fixed;
    bottom: 0; 
    left: 0; 
    right: 0;
    height: calc(var(--monitor-height) + env(safe-area-inset-bottom, 0px));
    /* Add padding so the text stays centered in the usable area */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--code-bg);
    color: var(--code-text);
    display: flex;
    align-items: center;
    padding: 0 30px;
    font-family: monospace;
    font-size: 12px;
    z-index: 101;
    max-width: 950px;
    margin: 0 auto;
    border-top: 2px solid var(--primary-dark);
}

.monitor-prompt {
    opacity: 1;
    margin-right: 10px;
    color: var(--orange);
}

.monitor-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.monitor-timestamp {
    opacity: 1;
    font-size: 10px;
    margin-left: 20px;
    color: var(--bg-body);
}

/* --- STATS GRID --- */
.stat-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); 
    gap: 12px; 
    width:94%;
    margin:auto;
}

.stat-box { 
    border: 1px solid var(--primary); 
    padding: 15px; 
    background: #fff; 
    
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.distribution-grid {
    display: grid;
    gap: 12px;
    width: 94%;
    grid-template-columns: 1fr;
    margin-left:auto;
}

.geo-distribution-grid {
    display: grid;
    gap: 12px;
    width: 94%;
    margin-left:auto;
    /* Default (Mobile): Stack them */
    grid-template-columns: 1fr;
}

/* 6-Column Layout Trick for 2-top, 3-bottom */
@media (min-width: 768px) {
    .geo-distribution-grid {
        width: 90%;
        margin:auto;
        grid-template-columns: repeat(6, 1fr);
    }

    .distribution-grid{
        width: 90%;
        margin: auto;
        grid-template-columns: 33% 33% 33%;
    }
    /* First 2 items take 50% (3/6) */
    .geo-distribution-grid > *:nth-child(1),
    .geo-distribution-grid > *:nth-child(2) {
        grid-column: span 3;
    }

    /* Next 3 items take 33% (2/6) */
    .geo-distribution-grid > *:nth-child(3),
    .geo-distribution-grid > *:nth-child(4),
    .geo-distribution-grid > *:nth-child(5) {
        grid-column: span 2;
    }
}

/* --- HIERARCHY COLUMNS --- */
.hierarchy-col {
    flex: 1;
    padding: 0; 
    height: 320px;
    overflow-y: auto;
    background: #fff;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
}

.geo-col {
    min-height: 200px; 
    max-height: 300px;
}

.hierarchy-title {
    border-bottom: 3px double var(--primary);
    padding: 12px 12px 8px 0px; /* Added padding here to replace container padding */
    margin-bottom: 0; /* REMOVED: Margin creates transparent gap; use padding instead */
    font-size: 14px;
    position: sticky;
    top: 0;
    background-color: #fff;
    z-index: 10;
}

/* New class to add padding to the list content so it aligns with the header */
.hierarchy-list {
    padding: 0 0px 12px 12px;
}

.hierarchy-item {
    display: flex; 
    justify-content: space-between; 
    font-size: 12px; 
    padding: 4px 6px; 
    border-bottom: 1px solid #f5f5f5; 
    cursor: pointer; 
    transition: background 0.15s ease;
}

@media (hover: hover){
.hierarchy-item:hover {
    background: var(--primary-dim);
}}

.hi-name, .hi-count {
    font-family: 'Fustat';
}

.hi-count {
    font-weight: 700; 
    color: var(--primary);
}

/* --- CONSOLE --- */
#api .section {
    display: flex;
    flex-direction: column;
    
}

/* Ensure the output box is the part that scrolls */
.console-output {
    background: #f5f5f5;
    padding: 12px;
    margin-top: 10px;
    font-family: monospace;
    font-size: 11px;
    border: 1px solid var(--primary);
    flex: 1;             /* Allows it to take up available space */
    height: 300px;       /* Gives it a fixed base height */
    overflow-y: scroll;  /* Forces the scrollbar to be active */
    display: flex;
    height:300px;
    max-height: 300px; /* Limits the total height of the console section */
    flex-direction: column; /* Keeps entries stacking correctly */
}

.console-entry {
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.console-prompt {
    color: #777; 
    margin-bottom: 5px; 
    font-weight: 600;
}
.console-result {
    margin: 0; 
    white-space: pre-wrap; 
    color: #222;
}

.console-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.console-input-container input {
    flex: 1;
    margin-bottom: 0;
}

.stat-num { 
    font-size: 1.8em; 
    color: var(--primary); 
    font-family: "Libertinus Math"; 
    font-weight:bold;
    margin-bottom: 5px;
}

.stat-lbl { 
    font-size: 12px; 
    text-transform: uppercase; 
    color: #666; 
    font-family: "Fustat"; 
    font-weight: 600;
    letter-spacing: 0.05em;
}



/* --- QUEUE LIST --- */
.queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    background: #fff;
    transition: background 0.15s ease;
    cursor: grab;
}

@media (hover: hover){
.queue-item:hover {
    background: #f9f9f9;
}}

.queue-item.current {
    background: var(--primary-dim);
    border-left: 3px solid var(--primary);
    cursor: default;
}

.queue-item[draggable="true"]:not(.current) {
    cursor: grab;
}

.queue-item[draggable="true"]:not(.current):active {
    cursor: grabbing;
}

.queue-item-info {
    flex: 1;
    min-width: 0;
}

.queue-item-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
}

.queue-item-number {
    font-weight: 700;
    margin-right: 8px;
    color: var(--primary);
}

.queue-item-meta {
    font-size: 10px;
    color: #888;
    font-family: "Fustat";
}

.queue-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.queue-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* --- PLAYLISTS --- */
.playlist-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    background: #f9f9f9;
    padding: 10px;
    border: 1px solid #eee;
}

.playlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #ddd;
    background: #fff;
    transition: all 0.15s ease;
}
@media (hover: hover){
.playlist-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}}

.playlist-info {
    flex: 1;
    min-width: 0;
}

.playlist-name {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 2px;
    color: var(--primary);
}

.playlist-meta {
    font-size: 10px;
    color: #888;
    font-family: "Fustat";
}

.playlist-actions {
    display: flex;
    gap: 6px;
    margin-left: 10px;
}

/* --- BADGES --- */
.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 9px;
    font-family: "Fustat";
    font-weight: 700;
    text-transform: uppercase;
    
    letter-spacing: 0.03em;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: var(--primary-dim);
    color: var(--primary-dark);
}

/* --- EMPTY STATES --- */
.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.empty-state-icon {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 15px;
}

/* --- API REFERENCE STYLES --- */
.api-section {
    margin-bottom: 30px;
    background: var(--bg-body);
    border: 3px double var(--primary);
    
    padding: 20px;
}

.api-section h4 {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: var(--primary);
}

.api-methods {
    display: grid;
    gap: 15px;
}

.api-method {
    border-left: 3px solid var(--primary-dim);
    padding-left: 15px;
}

.api-signature {
    font-family: monospace;
    font-size: 13px;
    color: var(--primary);
    background: var(--primary-dim);
    padding: 4px 8px;
    
    display: inline-block;
    margin-bottom: 6px;
}

.api-method p, .api-method li {
    font-size: 12px;
    color: #666;
    margin: 0;
}

/* --- DRAG AND DROP --- */

#playerQueueList {
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y; /* Allow vertical scroll, block horizontal/zoom */
}

.queue-drag-handle {
    display:flex!important;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.2;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
    margin-right: 8px;
    touch-action: none;
    cursor: grab;
}

.queue-item {
    touch-action: pan-y;
    user-select: none;
    /* Ensure no native dragging */
    -webkit-user-drag: none; 
    cursor: pointer;
}

@media (hover: hover) {
    .queue-item:hover .queue-drag-handle {
        opacity: 0.4;
    }
}

.queue-item.current .queue-drag-handle {
    opacity: 0.1;
}

.drag-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.queue-item.dragging {
    opacity: 0.5;
    background: var(--primary-dim);
    border: 2px dashed var(--primary);
    cursor: grabbing;
}

.dragging-ghost {
    position: fixed;
    z-index: 99999;
    pointer-events: none; /* Allows code to see what is underneath the ghost */
    opacity: 0.95;
    background: #fff;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    border: 1px solid var(--primary);
    list-style: none;
    margin: 0;
    padding: 10px;
    display: flex;
    align-items: center;
}

.queue-drop-indicator {
    height: 3px;
    background: var(--primary);
    margin: -2px 0;
    animation: dropPulse 0.8s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(23, 104, 218, 0.5);
}

.queue-drop-indicator::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

@keyframes dropPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* --- RESPONSIVE & MOBILE --- */
@media (max-width: 768px) {
    :root {
        --transport-height: 140px; /* Taller footer for stacked controls */
        --monitor-height: 30px;
        touch-action: manipulation;
    }

    body {
        padding: 15px 15px calc(var(--transport-height) + var(--monitor-height) + 10px + env(safe-area-inset-bottom, 0px)) 15px;
        /* SCROLL FIX: Allow body to scroll naturally on mobile */
        height: auto;
        overflow-y: auto;
        display: block;
    }

   

    /* SCROLL FIX: Remove internal tab scrolling */
    .tab-content {
        overflow: visible;
        height: auto;
        display: none; /* Override flex */
    }

    .tab-content.active {
        display: block; /* Stack content naturally */
    }

    /* 2. Header: Stack Logo & Text */
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        position: relative;
        z-index: 15;
    }
    
    .header-logo {
        width: 50px;
        height: 50px;
        margin-right: 5px;
    }

    h1 { font-size: 1.5em; }
    
    #statusIndicator {
        align-self: flex-start;
        margin-top: 5px;
    }

   
    
    .tabs::-webkit-scrollbar { display: none; }

    .tab-button {
        flex: 0 0 auto;
        font-size: 12px;
        padding: 8px 12px;
    }

    .tab-content{
        overflow-x: hidden;
    }

    /* 3. Registry: Collapsible Sidebar & Flow Layout */
    .registry-container { 
        display: flex;
        flex-direction: column;
        gap: 15px;
        height: auto; /* Remove fixed height constraints */
    }
    
    /* Hide the checkbox logic */
    .filter-toggle-cb { display: none; }

    .registry-sidebar { 
        max-height: none; 
        resize: none;
        border-bottom: 3px double var(--primary);
        padding: 10px 15px;
        overflow: visible; /* Let it grow */
    }

    /* Header with Toggle Button */
    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0; /* Tight when collapsed */
    }

    .filter-toggle-btn {
        background: #fff;
        border: 1px solid var(--primary);
        color: var(--primary);
        padding: 4px 12px;
        font-family: "Fustat", sans-serif;
        font-size: 11px;
        font-weight: 700;
        cursor: pointer;
        display: block; /* Visible on mobile */
    }

    /* Default State: Content Hidden */
    .sidebar-content {
        display: none;
        margin-top: 15px;
        border-top: 1px solid #eee;
        padding-top: 15px;
    }

    /* Expanded State: Content Visible (The Hack) */
    .filter-toggle-cb:checked ~ .sidebar-content {
        display: block;
        animation: slideDown 0.2s ease-out;
    }
    
    .filter-toggle-cb:checked ~ .sidebar-header .toggle-icon {
        content: "Hide ▴"; /* Change text via CSS if supported, or just rely on icon rotation */
    }

    /* Results: Remove internal scrolling, let the page scroll */
    .registry-results {
        padding-right: 0;
        overflow: visible; 
        height: auto;
    }
    
    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-5px); }
        to { opacity: 1; transform: translateY(0); }
    }

    /* 4. Global Transport: Stacked Layout */
    /* 4. Global Transport: Mobile Logic */
    .transport-toggle-btn {
        display: flex; /* Visible on Mobile */
    }

    .global-transport {
        /* Default: COLLAPSED State */
        height: 50px; 
        padding: 10px 15px;
        flex-direction: column;
        align-items: stretch;
        overflow: visible;
    }

    /* EXPANDED State */
    .global-transport.expanded {
        height: 190px; /* Space for everything */
    }

    .transport-main {
        flex-wrap: nowrap; /* Keep on one line in collapsed mode */
        justify-content: space-between;
        margin-bottom: 0;
        gap: 10px;
        align-items: center;
    }

    /* Info: Compact by default */
    .transport-info {
        width: auto;
        order: 0; /* Natural order: Prev, Info, Play, Next */
        text-align: left;
        margin: 0;
        padding: 0;
        flex: 1;
        border: none;
    }
    
    .transport-title {
        font-size: 12px;
        margin-bottom: 0;
    }
    
    .transport-info .meta {
        font-size: 12px !important;
        display: none; /* Hide time in mini mode to save space */
    }
    
    /* Show Time only when expanded */
    .global-transport.expanded .transport-info .meta {
        display: block;
    }

    .global-transport.expanded .transport-main {
        flex-wrap: wrap;
    }

    /* Controls (Vol/Speed): HIDDEN by default */
    .transport-controls {
        display: none;
        width: 100%;
        justify-content: space-between;
        margin-top: 15px;
        padding-top: 10px;
        border-top: 1px solid #f0f0f0;
        opacity: 0;
        transition: opacity 0.2s ease 0.1s;
    }
    
    .global-transport.expanded .transport-controls {
        display: flex;
        opacity: 1;
    }

    /* Scrubber: HIDDEN by default */
    .scrubber {
        display: none;
        margin-top: 12px;
    }

    .global-transport.expanded .scrubber {
        display: block;
    }

    .transport-control-group {
        font-size: 12px;
    }
    
    .transport-slider { width: 80px; }

    /* 5. Playback Tab: Wrap elements */
    .playback-control-panel { padding: 15px;
    margin-top:20px; }
    
    .playback-main-controls { gap: 10px; }
    
    .control-btn-large {
        width: 60px; height: 60px;
        font-size: 18px;
    }
    
    .control-btn-large.control-btn-play {
        width: 70px; height: 70px;
        font-size: 24px;
    }

    .playback-bar {
        padding: 5px;
    }
    
    .bar-input-group label { display: none; } /* Save space */
    .bar-input-group input { width: 60px !important; margin: 0; }
    .bar-separator { display: none; }

    /* 6. Grids */
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .inspector-grid { grid-template-columns: 1fr; }
    
    /* 7. Code Monitor */
    .code-monitor {
        padding: 0 10px;
        font-size: 10px;
    }

    /* -- BRIGISTICS HERO MOBILE --*/
    .brigistics-hero {
        flex-direction: column; /* Stack vertically for mobile */
        padding: 15px;
        gap: 15px;
        justify-content:center!important;
    }

    .hero-logo {
        flex: 0 0 100px; /* Keep logo at a readable "stamp" size */
        max-height: 100px;
        order: -1; /* Image stays on top */
        display:none!important;
    }

    .hero-actions {
        width: 100%;
        max-width: none;
    }

    .hero-btn {
        padding: 8px 12px; /* Shrink button height */
        max-width: 100%;
    }

    .hero-btn-text strong {
        font-size: 13px; /* Ensure text doesn't look "huge" on small screens */
    }
    
}

/* --- BRIGISTICS HERO --- */

.brigistics-hero, .about-hero {
    display: flex;
    flex-direction: row; /* Horizontal for desktop */
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 2.5%;
    background: #fff;
    border: 3px double var(--primary); /* Official double border */
    margin-bottom: 30px;
    position: relative;
    margin-top:15px;
}

/* Document Annotation */
.brigistics-hero::before {
    content: "Fast Access Ready Transmissions";
    position: absolute;
    top: -10px;
    left: 10px;
    background: var(--bg-body);
    padding: 0 10px;
    font-family: "Fustat", sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    max-width: 500px;
}

.hero-logo {
    flex: 0 1 200px; /* Allows logo to shrink but sets base size */
    max-height: 230px;
    width: auto;
    object-fit: contain;
    background: var(--bg-body);
    padding: 5px;
}

/* --- THE "ACTION" BUTTONS --- */
.hero-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: #fff;
    border: 1px solid var(--primary);
    cursor: pointer;
    text-align: left;
    width: 100%;
    border-radius: 0px !important; /* Document requirement: No round corners */
    transition: background 0.1s steps(2);
}

.hero-btn-icon {
    color: var(--orange);
    font-size: 1.5em;
}

@media (hover: hover) {
    .hero-btn:hover {
        background: var(--primary);
    }


    .hero-btn:hover .hero-btn-text strong,
    .hero-btn:hover .hero-btn-text span {
        color: #fff;
    }
}

.hero-btn-text strong {
    display: block;
    font-family: "Libertinus Math", serif; /* Document serif font */
    font-size: clamp(14px, 1.5vw, 18px); /* Fluid typography */
    color: var(--text-main);
    line-height: 1.1;
    font-size: 1.5em;
}

.hero-btn-text span {
    font-family: "Fustat", sans-serif;
    font-size: 9px;
    color: #666;
    text-transform: uppercase;
}

/* --- PLAYLIST SHARING --- */

/* Sharing Panel */
#sharingSectionPanel {
    margin-top: 20px;
}

.sharing-playlist-header {
    padding: 12px;
    background: var(--primary-dim);
    border-left: 3px solid var(--primary);
    margin-bottom: 16px;
}

.sharing-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
    margin-bottom: 4px;
}

.sharing-meta {
    font-size: 11px;
    color: var(--text-muted);
    font-family: "Fustat";
}

.sharing-qr-section {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid var(--primary-dim);
    margin-bottom: 16px;
    min-height: 240px;
}

.sharing-qr {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sharing-qr canvas {
    max-width: 100%;
    height: auto;
}

.sharing-code-section,
.sharing-url-section {
    margin-bottom: 16px;
}

.sharing-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-family: "Fustat";
    letter-spacing: 0.5px;
}

.sharing-code-box {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    background: var(--code-bg);
    padding: 10px;
    border: 1px solid var(--primary);
}

.sharing-code-box code {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: var(--code-text);
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    word-break: break-all;
    line-height: 1.4;
}

.sharing-code-box .icon-btn {
    flex-shrink: 0;
    padding: 5px 8px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--code-text);
    color: var(--code-text);
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .sharing-code-box .icon-btn:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(1.05);
    }
}

.sharing-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sharing-actions .player-queue-btn {
    flex: 1;
    min-width: 100px;
}


/* --- PLAYLIST SHARING CARD (Generated dynamically) --- */
.pc-share-card-container {
    font-family: "Fustat", sans-serif;
    width:400px;
    color: #fff;
    background: var(--bg-body);
    border: 4px double #1768da;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 5px;
    box-sizing: border-box;
    overflow: hidden;
        
        clip-path: polygon(
        0 0,                    /* Top Left */
        calc(100% - 125px) 0,    /* Top Right Start */
        100% 125px,              /* Right Side Drop */
        100% 100%,              /* Bottom Right */
        0 100%                  /* Bottom Left */
    );
    margin: 2em;
    transition: transform 0.2s ease, filter 0.2s ease;

}

.pc-share-card-container.interactive::after {
    content: "";
    position: absolute;
    
    /* VERTICAL FIX: Moves up to overlap the top border */
    top: -10px; 
    
    /* HORIZONTAL FIX: 
       100% is the padding-box width. 
       We subtract 121px (125px cut size minus 4px border width).
       This lands exactly on the start of the cut. 
    */
    left: calc(100% - 110px);
    
    /* Length: Hypotenuse of 125x125 is ~177px. We use 180px to be safe. */
    width: 180px; 
    
    /* Thickness */
    height: 16px; 
    
    background: #1768da;
    
    /* ROTATION: Pivot around the top-left corner of the bar */
    transform-origin: top left;
    transform: rotate(45deg);
    
    /* Layering */
    z-index: 20;
    pointer-events: none;
}

/* Background grid effect */
.pc-share-card-bg {
    pointer-events: none;
}

.pc-share-header {
    background: #1768da;
    color: #fff;
    font-family: "Libertinus Math";
    padding: 5px;
    font-weight: 800;
    font-size: 28px;
    z-index: 1;
    border-bottom: 2px solid #fff;
}

.pc-share-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1;
}

.pc-share-title {
    font-family: "Libertinus Math", serif;
    font-size: 28px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    line-height: 1.1;
    max-width: 230px;
    color: #000;
}

.pc-share-meta {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pc-share-qr-frame {
    background: #fff;
    padding: 10px;
    border: 2px solid #1768da;
    margin-bottom: 25px;
    margin-top: 25px;
}

.pc-share-footer {
    background: #1768da;
    color: #fff;
    padding: 15px;
    width: 100%;
    box-sizing: border-box;
    z-index: 1;
    text-align: center;
}

.pc-share-code-box {
    color: #fff;
    font-family: "Fustat";
    font-size: 8px;
    word-break: break-all;
    margin-top: 10px;
}

.pc-share-label {
    font-size: 12px;
    text-transform: uppercase;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}



/* The Action Bar (Replaces the Import Code footer) */
.pc-share-actions {
    background: var(--primary-dim);
    border-top: 2px solid var(--primary);
    padding: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 5px;
}

.pc-share-actions .icon-btn {
    width: 100%;
    justify-content: center;
    background: #fff;
    font-size: 9px;
    padding: 6px 0;
    margin: 0;
}

@media (hover: hover) {
    .pc-share-actions .icon-btn:hover {
        background: var(--primary);
        color: #fff;
    }

    /* Hover effect only for the interactive on-screen ones */
    .pc-share-card-container.interactive:hover {
        transform: translateY(-3px);
        filter: drop-shadow(12px 12px 16px rgba(23, 104, 218, 0.3));
    }
}

.pc-share-card-container.interactive{
    width: auto!important;
}



/* mini cards used in UI */
.playlist-mini-card {
    border: 3px double var(--primary);
    background: #fff;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s ease;
}

.mini-qr-preview {
    width: 80px;
    height: 80px;
    background: #f5f5f5;
    border: 1px solid var(--primary-dim);
}

/* Responsive */
@media (max-width: 768px) {
    .sharing-qr-section {
        min-height: 200px;
    }

    .import-notification-text {
        flex-direction: column;
        align-items: flex-start;
    }

    .sharing-actions {
        flex-direction: column;
    }

    .sharing-actions .player-queue-btn {
        width: 100%;
    }
}

.pc-queue-preview {
    background: #fff;
    border: 1px dashed var(--primary);
    padding: 10px;
    margin-bottom: 15px;
    max-height: 120px;
    overflow-y: auto;
    font-family: "Fustat", sans-serif;
}

.pc-preview-header {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 5px;
    border-bottom: 1px solid #eee;
    padding-bottom: 2px;
    display: flex;
    justify-content: space-between;
}

.pc-preview-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pc-preview-item {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-main);
    padding: 2px 0;
    border-bottom: 1px dotted #f0f0f0;
}

.pc-preview-item:last-child {
    border-bottom: none;
}

.pc-preview-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
    font-weight: 600;
}

.pc-preview-meta {
    color: #888;
    font-family: monospace;
}

.pc-preview-empty {
    color: #999;
    font-style: italic;
    font-size: 10px;
    text-align: center;
    padding: 10px 0;
}

/* Ensure the punchcard reader wrapper accommodates the new element gracefully */
.punchcard-reader-wrapper {
    display: flex;
    flex-direction: column;
}

/* --- PUNCHCARD EXPORT ANIMATION --- */

/* The overlay container that appears during export */
.pc-exporting-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(23, 104, 218, 0.1);
    z-index: 20;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* The horizontal scanning line */
.pc-export-scanner-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
    box-shadow: 0 0 15px var(--primary);
    animation: pc-scan-move 1.5s linear infinite;
}

/* Status text that appears over the card */
.pc-export-status-text {
    background: var(--primary);
    color: #fff;
    font-family: "Fustat", sans-serif;
    font-size: 14px;
    font-weight: 700;
    padding: 4px 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    z-index: 21;
}

@keyframes pc-scan-move {
    0% { top: 0%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* Button loading state */
.icon-btn.is-exporting {
    background: var(--primary-dim) !important;
    color: var(--primary) !important;
    cursor: wait;
}


/* --- UTILITY CLASSES --- */
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-center { text-align: center; }
.margin-left-auto {margin-left:auto;}


/* --- PRINTER ANIMATION --- */

.pc-printer-mask {
    position: fixed;
    z-index: 9000;
    overflow: hidden; 
    background: transparent;
    
    /* Start with no border or height */
    border-top: 0px solid var(--primary-dark);
    height: 0px;
    
    /* Animate the slot carving into the UI */
    transition: 
        height 2s cubic-bezier(0.2, 0.8, 0.2, 1),
        border-top-width 0.4s ease-out; /* Slot appears quickly first */
    
    pointer-events: none; 
}

/* helper class for the JS to trigger the border */
.pc-printer-mask.open-slot {
    border-top-width: 4px;
}

.pc-printer-mask.close-slot{
    border-top-width: 0px;
}

/* The card inside the mask */
.pc-printer-mask .pc-share-card-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%); /* Center it */
    margin: 0 !important;
    
    /* CRITICAL: Force dimensions so it can't be "narrow" */
    
    min-width: 300px !important;
    box-sizing: border-box;
    
    /* PRINTING ANIMATION (Slide Down) */
    transition: top 1.5s cubic-bezier(0.45, 0, 0.55, 1);
}

.pc-share-card-container.pop-in {
    animation: gridPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
}

@keyframes gridPop {
    0% { opacity: 0; transform: scale(1.5) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* PHYSICS DROP STATE */
.pc-share-card-container.falling {
    position: fixed !important;
    z-index: 9999 !important;
    pointer-events: none;
    margin: 0 !important;
    
    /* Explicitly lock width again to prevent snapping */
    width: 300px !important; 
    
    /* The Drop */
    animation: gravityDrop 0.8s ease-in forwards;
}

@keyframes gravityDrop {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(120vh) rotate(10deg);
        opacity: 1;
    }
}
    
/* --- SHRED ANIMATION --- */
@keyframes ripTop {
    0% {
        transform: translateY(0) rotate(0);
        opacity: 1;
    }

    100% {
        transform: translateY(-40px) rotate(-5deg);
        opacity: 0;
    }
}

@keyframes ripBottom {
    0% {
        transform: translateY(0) rotate(0);
        opacity: 1;
    }

    100% {
        transform: translateY(100px) rotate(5deg);
        opacity: 0;
    }
}

.rip-piece {
    position: fixed;
    /* Lock to screen, ignore container flow */
    z-index: 9999;
    pointer-events: none;
    width: 350px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* --- USER PROFILE STYLES --- */
.user-badge {
    cursor: pointer;
    background: var(--primary-dim);
    padding: 4px 8px;
    border: 1px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

@media (hover: hover){
    .user-badge:hover { background: #fff; transform: translateY(-1px); }
}

.notif-dot {
    background: var(--danger);
    color: #fff;
    font-family: "Fustat";
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
}
.notification-card {
    background: #fff;
    border-left: 3px solid var(--primary);
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.notification-card.unread {
    background: var(--primary-dim);
    border-left-color: var(--orange);
}