/* Modern Design Variables & Color Palettes */
:root {
    --font-primary: 'Outfit', 'Noto Sans KR', sans-serif;
    
    /* Dark Theme (Default) Colors */
    --bg-base: #0b0f19;
    --bg-surface: rgba(17, 24, 39, 0.7);
    --bg-surface-solid: #111827;
    --bg-card: rgba(31, 41, 55, 0.4);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-focus: #6366f1;
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Premium Gradients and Highlights */
    --accent-primary: #4f46e5;
    --accent-secondary: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    --hover-gradient: linear-gradient(135deg, #6366f1 0%, #22d3ee 100%);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-blur: blur(12px);
    
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

/* Light Theme Variables */
body.light-theme {
    --bg-base: #f3f4f6;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-surface-solid: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.8);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-color-focus: #4f46e5;
    
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font-family: inherit;
}

/* App Layout */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background-color: var(--bg-surface-solid);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
    z-index: 10;
}

.sidebar-header {
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex-grow: 1;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 12px;
    gap: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.sidebar-nav li.active a,
.sidebar-nav a:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.sidebar-nav li.active a {
    background: var(--accent-gradient);
    color: white;
}

.sidebar-nav .badge {
    margin-left: auto;
    background-color: var(--border-color);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.sidebar-nav li.active .badge {
    background-color: rgba(255, 255, 255, 0.2);
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.theme-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.app-version {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* Switch UI Component */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background: var(--accent-gradient);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Main Dashboard Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

/* Header */
.main-header {
    height: 80px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-surface-solid);
    position: sticky;
    top: 0;
    z-index: 5;
}

.header-search {
    display: flex;
    align-items: center;
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 12px;
    width: 450px;
    gap: 12px;
    transition: border-color 0.2s;
}

.header-search:focus-within {
    border-color: var(--border-color-focus);
}

.header-search input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    width: 100%;
    font-size: 14px;
}

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

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Dashboard Body Container */
.dashboard-body {
    padding: 40px;
    flex-grow: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Welcome Banner Section */
.welcome-banner {
    background: var(--accent-gradient);
    border-radius: 24px;
    padding: 40px;
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 10px 30px rgba(79, 70, 229, 0.3);
}

.banner-content h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
}

.banner-content p {
    font-size: 16px;
    opacity: 0.9;
    max-width: 600px;
    line-height: 1.6;
}

.banner-stats {
    display: flex;
    gap: 24px;
}

.stat-card {
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 20px 24px;
    border-radius: 16px;
    text-align: center;
    min-width: 140px;
}

.stat-num {
    display: block;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-lbl {
    font-size: 12px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filters and Grid Controls */
.filters-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.quick-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    background-color: var(--bg-surface-solid);
    border: 1px solid var(--border-color);
    padding: 10px 18px;
    border-radius: 100px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.filter-btn.active {
    background-color: var(--text-primary);
    color: var(--bg-base);
    border-color: var(--text-primary);
}

.results-info {
    font-size: 14px;
    color: var(--text-muted);
}

/* Submissions Cards Grid */
.submissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    min-height: 200px;
}

.loading-spinner-container {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes rotate {
    to { transform: rotate(360deg); }
}

/* Submission Card Component */
.sub-card {
    background-color: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.sub-card:hover {
    transform: translateY(-8px) scale(1.01);
    border-color: var(--border-color-focus);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.15);
}

.sub-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.sub-index {
    background: var(--accent-gradient);
    color: white;
    font-weight: 700;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 8px;
}

.sub-company-tag {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 6px;
    background-color: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.sub-card-body {
    margin-bottom: 24px;
    flex-grow: 1;
}

.sub-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.4;
    color: var(--text-primary);
}

.sub-meta {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sub-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.sub-file-badges {
    display: flex;
    gap: 6px;
}

.file-badge {
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: 600;
    background-color: var(--border-color);
    color: var(--text-secondary);
}

.file-badge.badge-pptx { background-color: rgba(239, 68, 68, 0.15); color: #f87171; }
.file-badge.badge-pdf { background-color: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.file-badge.badge-html { background-color: rgba(16, 185, 129, 0.15); color: #34d399; }
.file-badge.badge-zip { background-color: rgba(139, 92, 246, 0.15); color: #a78bfa; }

.sub-view-action {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.sub-card:hover .sub-view-action {
    color: #22d3ee;
}

/* Modal Overlay & Container */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(3, 7, 18, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    width: 92vw;
    height: 90vh;
    max-width: 1500px;
    background-color: var(--bg-surface-solid);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay:not(.hidden) .modal-container {
    transform: scale(1);
}

.modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title-area {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-badge {
    align-self: flex-start;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    background-color: var(--accent-primary);
    color: white;
}

#modal-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Modal Body split pane */
.modal-body {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

.viewer-pane {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}

.viewer-tabs {
    padding: 12px 32px 0 32px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--border-color-focus);
    border-bottom-color: var(--border-color-focus);
}

.viewer-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #000;
}

.tab-panel {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.tab-panel.active {
    display: flex;
}

/* Preview controls */
.preview-selector-bar {
    padding: 8px 16px;
    background-color: var(--bg-surface-solid);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.preview-selector-bar select {
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 6px;
    outline: none;
}

.preview-display {
    flex-grow: 1;
    position: relative;
    width: 100%;
    height: 100%;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: #fff;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    padding: 40px;
    text-align: center;
    background-color: var(--bg-base);
}

.placeholder-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Guide panel text */
.guide-text-content {
    padding: 32px;
    overflow-y: auto;
    height: 100%;
    white-space: pre-wrap;
    font-family: Consolas, monospace;
    font-size: 14px;
    color: #e5e7eb;
    background-color: #111827;
    line-height: 1.7;
}

/* Modal Sidebar */
.modal-sidebar {
    width: 380px;
    padding: 32px;
    overflow-y: auto;
    background-color: var(--bg-surface-solid);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.sidebar-section h3 {
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    border-left: 3px solid var(--accent-primary);
    padding-left: 8px;
}

.action-buttons-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    background: var(--hover-gradient);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: var(--border-color);
}

.btn-block {
    width: 100%;
}

.download-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.download-list li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 13px;
    transition: all 0.2s;
}

.download-list li a:hover {
    border-color: var(--border-color-focus);
    background-color: rgba(99, 102, 241, 0.05);
}

.metadata-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.metadata-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    padding: 8px 0;
    width: 35%;
}

.metadata-table td {
    color: var(--text-primary);
    font-weight: 600;
    padding: 8px 0;
}

/* Auth Overlay card styles */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #030712;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}

.auth-overlay.hidden {
    display: none;
}

.auth-card {
    background-color: var(--bg-surface-solid);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 420px;
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.4s ease;
}

.auth-logo {
    width: 60px;
    height: 60px;
    background: var(--accent-gradient);
    border-radius: 16px;
    margin: 0 auto 24px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 24px;
    color: white;
}

.auth-card h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

.auth-card p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 32px;
}

.auth-card input {
    width: 100%;
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    padding: 14px 20px;
    border-radius: 12px;
    color: var(--text-primary);
    outline: none;
    font-size: 15px;
    margin-bottom: 16px;
    text-align: center;
    transition: border-color 0.2s;
}

.auth-card input:focus {
    border-color: var(--border-color-focus);
}

.error-msg {
    color: var(--error);
    font-size: 13px;
    font-weight: 500;
    margin-top: 12px;
}

.hidden {
    display: none !important;
}

/* Responsive details */
@media (max-width: 1024px) {
    .modal-container {
        height: 95vh;
        width: 96vw;
    }
    .modal-body {
        flex-direction: column;
        overflow-y: auto;
    }
    .viewer-pane {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        height: 500px;
        flex-shrink: 0;
    }
    .modal-sidebar {
        width: 100%;
        overflow-y: visible;
    }
}

@media (max-width: 768px) {
    .dashboard-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .main-header {
        padding: 0 20px;
        height: 70px;
    }
    .header-search {
        width: 100%;
    }
    .dashboard-body {
        padding: 20px;
    }
    .welcome-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 24px;
        padding: 24px;
    }
    .banner-stats {
        width: 100%;
        justify-content: space-between;
    }
}
