/* 
 * modern-ui.css - Professional & Clean Design System 
 * Optimized for Smart Signage Management
 */

:root {
    /* High-Contrast Premium Palette */
    --color-bg-deep: #020617;
    /* Deeper Black */
    --color-bg-surface: #0f172a;
    /* Stronger Surface Contrast */
    --color-bg-card: #1e293b;
    /* Solid, Sharp Cards */

    --color-primary: #6366f1;
    /* Vibrant Indigo Accent */
    --color-primary-glow: rgba(99, 102, 241, 0.4);
    --color-secondary: #94a3b8;

    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;

    --color-text-main: #ffffff;
    --color-text-muted: #cbd5e1;
    --color-border: rgba(255, 255, 255, 0.15);

    /* Spacing & Borders */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;

    /* Typography */
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;

    /* Shadows */
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.2);
    --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--color-bg-deep);
    color: var(--color-text-main);
    line-height: 1.5;
    min-height: 100vh;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background: var(--color-bg-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    left: 0;
    overflow: hidden;
    /* Prevent sidebar itself from scrolling */
}

.logo-section {
    flex-shrink: 0;
    /* Keep logo fixed */
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1.5rem 1rem;
}

.logo-icon {
    font-size: 1.5rem;
    color: var(--color-primary);
}

.logo-text {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
}

.nav-list {
    list-style: none;
    flex: 1;
    /* Grow to fill available space */
    overflow-y: auto;
    /* Enable scrolling */
    overflow-x: hidden;
    padding: 1rem 1rem;
    min-height: 0;
    /* Important for flex scroll */
}

/* Sidebar Specific Scrollbar - HIGH VISIBILITY */
.nav-list::-webkit-scrollbar {
    width: 6px;
    display: block;
}

.nav-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.nav-list::-webkit-scrollbar-thumb {
    background: #6366f1;
    border-radius: 10px;
}

.nav-list::-webkit-scrollbar-thumb:hover {
    background: #818cf8;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    /* Reduced vertical padding */
    color: var(--color-text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.825rem;
    /* Sleeker text size */
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    /* Slightly smaller icons */
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-main);
}

.nav-link.active {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 12px var(--color-primary-glow);
}

.sidebar-footer {
    flex-shrink: 0;
    /* Keep logout fixed */
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border);
    margin-top: auto;
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 2rem;
    /* Reduced padding for more grid room */
    max-width: 1600px;
    /* Increased max-width */
    margin: 0;
    width: 100%;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-title h1 {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--color-bg-surface);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: border-color 0.2s;
}

.user-profile:hover {
    border-color: var(--color-primary);
}

.avatar {
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

/* Cards & Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr) !important;
    /* HARD FORCE 4 COLUMNS */
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.glass-card {
    background: var(--color-bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1.15rem 1.25rem;
    /* Reduced height */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-item:hover {
    transform: translateY(-3px);
    border-color: var(--color-primary);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.stat-icon {
    width: 42px;
    /* Smaller icon container */
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.stat-info .label {
    display: block;
    color: var(--color-text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.1rem;
}

.stat-info .value {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

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

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Status Badges */
.status-pill {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-online {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status-offline {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    /* Darker backdrop */
    backdrop-filter: blur(8px);
    /* Deeper blur */
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
}

.modal-content {
    background: var(--color-bg-surface);
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    /* Restricted height */
    overflow-y: auto;
    /* Internal scrolling */
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    padding: 2rem;
    position: relative;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.modal-body {
    flex: 1;
}

/* Professional Analytics & Reports */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.report-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s;
}

.report-card:hover {
    transform: translateY(-4px);
    border-color: var(--color-primary);
}

.report-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.report-label {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Timeline Components */
.timeline {
    position: relative;
    padding-left: 2.5rem;
    margin-top: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-border);
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-dot {
    position: absolute;
    left: -2.25rem;
    top: 0.25rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 3px solid var(--color-bg-surface);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.timeline-content {
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.timeline-time {
    font-size: 0.75rem;
    color: var(--color-primary);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.timeline-event {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: white;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    background: rgba(0, 0, 0, 0.3);
}

/* Specific fix for calendar indicator visibility in dark mode */
input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* Custom Scrollbar Styling - HIGH VISIBILITY VIBRANT */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-deep);
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    /* Vibrant Indigo thumb */
    border-radius: 5px;
    border: 2px solid var(--color-bg-deep);
    /* Contrast gap */
}

::-webkit-scrollbar-thumb:hover {
    filter: brightness(1.2);
}

/* Modal Internal Scrollbar */
.modal-content::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-color: var(--color-bg-surface);
}

/* Toast System */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--color-bg-surface);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 2000;
    transition: all 0.3s;
}

.toast-success {
    border-left-color: var(--color-success);
}

.toast-error {
    border-left-color: var(--color-danger);
}

.toast-warning {
    border-left-color: var(--color-warning);
}

/* Animations - VISIBILITY SAFE */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Slide Up with no initial concealment fallback to avoid invisible content */
@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-up {
    animation: slideInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ========== Global Components ========== */

/* Data Tables */
.table-container {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    overflow: hidden;
    margin-top: 1.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}

.data-table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
    color: var(--color-text-main);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 3rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-zone:hover {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.05);
    /* Indigo tint */
}

/* Interactive Card Hover Effect */
.hover-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.hover-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-primary);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.hover-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.hover-card:hover::before {
    opacity: 1;
}

/* Clickable Assets & Preview */
.clickable-asset {
    cursor: pointer;
    color: var(--color-primary);
    transition: all 0.2s ease;
    text-decoration: none;
    font-weight: 600;
}

.clickable-asset:hover {
    color: #818cf8;
    /* Lighter indigo */
    text-decoration: underline;
}

.preview-modal-content {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.preview-modal-content img,
.preview-modal-content video {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-md);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}