/* Premium Modern Theme & Glassmorphism Variables */
:root {
    /* Brand Colors - Vibrant & Deep */
    --primary-color: #6366f1;
    /* Indigo 500 */
    --primary-hover: #4f46e5;
    /* Indigo 600 */
    --primary-light: #e0e7ff;
    /* Indigo 100 */
    --primary-glow: rgba(99, 102, 241, 0.5);

    --secondary-color: #ec4899;
    /* Pink 500 */
    --secondary-hover: #db2777;
    /* Pink 600 */
    --secondary-light: #fce7f3;
    /* Pink 100 */

    --accent-color: #8b5cf6;
    /* Violet 500 */

    /* Backgrounds */
    --bg-body: #f3f4f6;
    /* Cool Gray 100 */
    --bg-sidebar: rgba(255, 255, 255, 0.9);
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-glass: rgba(255, 255, 255, 0.7);

    /* Text */
    --text-main: #111827;
    /* Gray 900 */
    --text-muted: #6b7280;
    /* Gray 500 */
    --text-light: #9ca3af;
    /* Gray 400 */

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Borders & Shadows */
    --border-color: rgba(229, 231, 235, 0.8);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.3);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-secondary: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    --gradient-dark: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --gradient-bg: radial-gradient(circle at top left, #e0e7ff 0%, #f3f4f6 40%, #f3f4f6 100%);
}

/* Global Reset & Typography */
* {
    box-sizing: border-box !important;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    background-image: var(--gradient-bg);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- Layout Structure (CSS Grid) --- */
.app-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar Styling - Premium */
.sidebar {
    background: var(--bg-sidebar);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
}

.sidebar-logo {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-svg {
    width: 100%;
    max-width: 140px;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 6px rgba(99, 102, 241, 0.2));
}

.moscow-time {
    text-align: center;
    color: var(--primary-hover);
    font-size: 0.85rem;
    font-weight: 700;
    background: rgba(224, 231, 255, 0.6);
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    letter-spacing: 0.5px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    margin-top: 0.5rem;
    backdrop-filter: blur(4px);
}

.sidebar-nav {
    padding: 0 1.25rem 2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-section-title {
    padding: 1.75rem 1rem 0.75rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-light);
    font-weight: 800;
    opacity: 0.9;
}

.sidebar-link {
    padding: 0.85rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 1rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.sidebar-link:hover {
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
    border-color: rgba(99, 102, 241, 0.1);
}

.sidebar-link.active {
    color: #fff;
    background: var(--gradient-primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    font-weight: 600;
    border: none;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    margin-right: 12px;
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

.sidebar-link:hover i {
    transform: scale(1.1);
}

/* Main Content Area */
.main-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

/* Top Navbar - Glass */
.topbar {
    height: 70px;
    padding: 0 2rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Modal Styling */
.modal-content {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0;
    overflow: hidden;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.5);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.5);
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.3px;
}

.topbar-title i {
    color: var(--primary-color);
    background: var(--primary-light);
    padding: 0.4rem;
    border-radius: 0.5rem;
    font-size: 1.1rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-icon {
    height: 42px;
    width: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: none;
}

.topbar-icon:hover {
    color: var(--primary-color);
    background: white;
    border-color: var(--border-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.5rem 0.35rem 0.75rem;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid transparent;
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    height: 42px;
}

.topbar-user:hover {
    background: white;
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

/* Content Body */
.main-content {
    padding: 2rem;
    flex-grow: 1;
    max-width: 1600px;
    /* Prevent stretching on huge screens */
    margin: 0 auto;
    width: 100%;
}

/* Premium Cards */
.card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.01);
    border-color: var(--primary-light);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.6);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h5 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Buttons - Premium */
/* Buttons - Premium Modern System */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    letter-spacing: 0.2px;
    line-height: 1.5;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light), 0 0 0 1px var(--primary-color);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.5);
}

/* Variants */
.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.25);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(99, 102, 241, 0.35);
    color: white;
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--bg-body);
    border-color: var(--text-muted);
    transform: translateY(-1px);
    color: var(--text-main);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
    border: none;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(16, 185, 129, 0.35);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
    border: none;
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(239, 68, 68, 0.35);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.25);
    border: none;
}

.btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(245, 158, 11, 0.35);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.25);
    border: none;
}

.btn-info:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(59, 130, 246, 0.35);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    box-shadow: none;
    border: 1px solid transparent;
}

.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

.btn-link {
    background: transparent;
    color: var(--primary-color);
    box-shadow: none;
    padding: 0;
    border: none;
    font-weight: 500;
}

.btn-link:hover {
    text-decoration: underline;
    color: var(--primary-hover);
    transform: none;
}

/* Outline Variants */
.btn-outline-primary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

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

/* Sizes */
.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 0.5rem;
}

.btn-lg {
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    border-radius: 1rem;
}

.btn-icon {
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon.btn-sm {
    width: 28px;
    height: 28px;
}

.btn-icon.btn-lg {
    width: 48px;
    height: 48px;
}

/* Tabs */
.btn-tab {
    background: transparent;
    color: var(--text-muted);
    border-radius: 0;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    box-shadow: none;
    transition: all 0.2s ease;
}

.btn-tab:hover {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.btn-tab.active-tab {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

/* Form Elements */
.form-control {
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    background: white;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

/* Close Buttons */
.alert-close,
.modal-close {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.25rem;
    line-height: 1;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.alert-close:hover,
.modal-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

/* Responsive */
@media (max-width: 1024px) {
    .app-layout {
        grid-template-columns: 80px 1fr;
    }

    .sidebar-logo .logo-svg,
    .sidebar-section-title,
    .sidebar-link span,
    .moscow-time {
        display: none;
    }

    .sidebar-link {
        justify-content: center;
        padding: 0.75rem;
    }

    .sidebar-link i {
        margin: 0;
        font-size: 1.25rem;
    }

    .topbar {
        padding: 0 1.5rem;
    }

    .main-content {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
        /* Stack layout on mobile */
    }

    /* Mobile Sidebar - Slide in Drawer */
    .sidebar {
        display: flex;
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 1000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
    }

    .sidebar.show {
        left: 0;
    }

    /* Restore sidebar content for mobile drawer */
    .sidebar-logo .logo-svg,
    .sidebar-section-title,
    .sidebar-link span,
    .moscow-time {
        display: block;
    }

    .sidebar-link {
        justify-content: flex-start;
        padding: 0.85rem 1.25rem;
    }

    .sidebar-link i {
        margin-right: 12px;
        font-size: 1.1rem;
    }

    /* Mobile Menu Toggle */
    .topbar-left-mobile {
        display: block;
        margin-right: 1rem;
    }

    .mobile-menu-toggle {
        background: none;
        border: none;
        font-size: 1.25rem;
        color: var(--text-main);
        cursor: pointer;
        padding: 0.5rem;
        border-radius: 0.5rem;
        transition: background 0.2s;
    }

    .mobile-menu-toggle:active {
        background: rgba(0, 0, 0, 0.05);
    }

    /* Overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        backdrop-filter: blur(4px);
    }

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
}

/* Hide mobile toggle on desktop */
.topbar-left-mobile {
    display: none;
}

@media (max-width: 768px) {
    .topbar-left-mobile {
        display: block;
    }
}