:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --accent: #f59e0b;
    --dark: #1f2937;
    --dark-light: #374151;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    line-height: 1.6;
}

/* Dashboard Layout */
.dashboard {
    display: grid;
    grid-template-areas: 
        "header header"
        "sidebar main";
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}

/* Header */
.header {
    grid-area: header;
    background: var(--white);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #ecfdf5;
    color: #047857;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-600);
    padding: 0.5rem;
    border-radius: 6px;
    transition: var(--transition);
}

.mobile-toggle:hover {
    background: var(--gray-100);
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    padding: 2rem 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-title {
    padding: 0 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--gray-600);
    text-decoration: none;
    transition: var(--transition);
    border-right: 3px solid transparent;
    gap: 0.75rem;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.875rem;
}

.nav-item:hover, .nav-item.active {
    color: var(--primary);
    background: #f0f9ff;
    border-right-color: var(--primary);
}

.nav-icon {
    font-size: 1.25rem;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main {
    grid-area: main;
    padding: 2rem;
    overflow-y: auto;
    background: var(--gray-50);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-title {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.stat-description {
    font-size: 0.75rem;
    color: var(--gray-600);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    width: 70px;
    height: 70px;
    border: 8px solid transparent;
    border-top: 8px solid #ff416c;
    border-right: 8px solid #ff4b2b;
    border-bottom: 8px solid #ffcc00;
    border-left: 8px solid #00d2d3;
    border-radius: 50%;
    animation: spin 1.5s ease-in-out infinite, glow 2s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(0, 210, 211, 0.7);
}

.loading-text {
    color: #ffffff;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 0 15px #ffcc00, 0 0 30px #00d2d3;
    margin-top: 20px;
    animation: pulse 1.5s infinite;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes glow {
    0% { box-shadow: 0 0 10px rgba(0, 210, 211, 0.5); }
    50% { box-shadow: 0 0 30px rgba(255, 204, 0, 0.8); }
    100% { box-shadow: 0 0 10px rgba(0, 210, 211, 0.5); }
}

/* Viewer Container */
.viewer-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    height: calc(100vh - 200px);
    min-height: 600px;
}

.viewer-header {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.viewer-title {
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.viewer-actions {
    display: flex;
    gap: 0.5rem;
}

.iframe-container {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--white);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-success {
    background: var(--secondary);
    color: var(--white);
}

.btn-success:hover {
    background: #059669;
}

/* Forms */
.settings-form {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-width: 600px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-help {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-top: 0.25rem;
}

/* Error States */
.error-container {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--gray-600);
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ef4444;
}

/* Page Transitions */
.page-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease-out;
}

.page-exit {
    opacity: 1;
    transform: translateY(0);
}

.page-exit-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease-out;
}

/* Feature Cards */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto 3rem;
}

.feature-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 16px;
    text-align: left;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Keyboard shortcuts */
kbd {
    background: var(--gray-200);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
    border: 1px solid var(--gray-300);
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard {
        grid-template-areas: 
            "header"
            "main";
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        z-index: 200;
        transition: var(--transition);
        box-shadow: var(--shadow-lg);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .mobile-toggle {
        display: block;
    }
}

@media (max-width: 768px) {
    .main {
        padding: 1rem;
    }
    
    .header {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .viewer-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .viewer-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .feature-grid {
        grid-template-columns: 1fr !important;
    }
    
    .loading-text {
        font-size: 16px;
    }
    
    .loading-spinner {
        width: 50px;
        height: 50px;
        border-width: 6px;
    }
}

@media (max-width: 480px) {
    .header-left .logo {
        font-size: 1.25rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .viewer-container {
        height: calc(100vh - 160px);
        min-height: 500px;
    }
}