/* LMS System Styles - Premium, Modern, Dark Mode */

/* Global Import for Inter font (if not already handled in HTML head, but typical for premium feel) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Base Palette */
    --lms-bg-dark: #0f172a;
    /* Slate 900 - Deep, rich background */
    --lms-bg-darker: #020617;
    /* Slate 950 - Sidebar/Darker areas */

    /* Surface Colors (Glassmorphism bases) */
    --lms-surface: rgba(30, 41, 59, 0.7);
    /* Slate 800 with opacity */
    --lms-surface-hover: rgba(51, 65, 85, 0.8);
    /* Slate 700 with opacity */

    /* Text */
    --lms-text-primary: #f8fafc;
    /* Slate 50 */
    --lms-text-secondary: #94a3b8;
    /* Slate 400 */
    --lms-text-muted: #64748b;
    /* Slate 500 */

    /* Accents (Vibrant & Neon) */
    --lms-accent: #10b981;
    /* Emerald 500 - Primary Green */
    --lms-accent-glow: rgba(16, 185, 129, 0.5);
    --lms-accent-hover: #34d399;
    /* Emerald 400 */

    /* Borders */
    --lms-border: rgba(255, 255, 255, 0.08);
    --lms-border-hover: rgba(255, 255, 255, 0.15);

    /* Shadows */
    --lms-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --lms-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --lms-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Status Colors */
    --lms-success: #10b981;
    --lms-warning: #f59e0b;
    --lms-danger: #ef4444;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body.lms-body {
    background-color: var(--lms-bg-dark);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(16, 185, 129, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(56, 189, 248, 0.08), transparent 25%);
    color: var(--lms-text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.lms-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar - Modern Navigation Rail Style */
.lms-sidebar {
    width: 280px;
    background-color: rgba(2, 6, 23, 0.8);
    /* See-through darker bg */
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--lms-border);
    padding: 24px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.lms-sidebar .brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.025em;
}

.lms-sidebar .brand span {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lms-nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--lms-text-secondary);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    font-weight: 500;
}

.lms-nav-item i {
    width: 24px;
    /* Fixed width for icon alignment */
    text-align: center;
    margin-right: 12px;
    font-size: 1rem;
    transition: color 0.2s;
}

.lms-nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--lms-text-primary);
    transform: translateX(4px);
}

.lms-nav-item.active {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.0) 100%);
    color: var(--lms-accent);
    border-left: 3px solid var(--lms-accent);
    border-radius: 0 8px 8px 0;
    /* Only round right side */
    padding-left: 13px;
    /* Adjust for border width (16 - 3) */
}

.lms-nav-item.active i {
    color: var(--lms-accent);
    filter: drop-shadow(0 0 8px var(--lms-accent-glow));
}

/* Main Content */
.lms-main {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
    max-width: 1600px;
    /* Prevent stretching on ultrawides */
}

/* Components - Card */
.lms-card {
    background: var(--lms-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--lms-border);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--lms-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    /* Context for absolute children */
}

.profile-card-banner {
    height: 140px;
    background: linear-gradient(120deg, var(--lms-bg-dark), #064e3b);
    /* Dark to Emerald */
    background-image:
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.3) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(56, 189, 248, 0.3) 0px, transparent 50%);
    border-radius: 16px 16px 0 0;
    margin: -32px -32px 32px -32px;
    /* Negative margin to fill card top */
    border-bottom: 1px solid var(--lms-border);
}

.lms-card:hover {
    border-color: var(--lms-border-hover);
    box-shadow: var(--lms-shadow-lg);
}

.lms-card-header {
    border-bottom: 1px solid var(--lms-border);
    padding-bottom: 20px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lms-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--lms-text-primary);
}

/* Titles */
h2,
h3,
h4,
h5 {
    color: var(--lms-text-primary);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

/* Buttons */
.lms-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    gap: 8px;
}

.lms-btn-primary {
    background: var(--lms-accent);
    color: #000;
    box-shadow: 0 0 15px -3px var(--lms-accent-glow);
}

.lms-btn-primary:hover {
    background-color: var(--lms-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 0 20px -3px var(--lms-accent-glow);
}

.lms-btn-primary:active {
    transform: translateY(0);
}

.lms-btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* Increased visibility */
    color: #cbd5e1;
    /* Lighter text (Slate 300) */
}

.lms-btn-outline:hover {
    border-color: var(--lms-text-primary);
    color: var(--lms-text-primary);
    background: rgba(255, 255, 255, 0.1);
}

/* Form Controls */
.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--lms-text-secondary);
    transition: color 0.2s;
}

.lms-input,
.lms-select,
.lms-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--lms-border);
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--lms-text-primary);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.lms-input:focus,
.lms-select:focus,
.lms-textarea:focus {
    outline: none;
    border-color: var(--lms-accent);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
    background-color: rgba(255, 255, 255, 0.05);
}

/* Fix for Dropdown Options */
.lms-select option {
    background-color: #1e293b;
    /* Solid dark background required for options */
    color: #f8fafc;
}

.lms-input::placeholder {
    color: rgba(148, 163, 184, 0.4);
}

/* Badges & Utility */
.text-muted {
    color: var(--lms-text-secondary) !important;
}

.lms-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.badge-draft {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.badge-published {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.1);
}

.badge-archived {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.1);
}

/* Tables */
.lms-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
}

.lms-table th {
    text-align: left;
    padding: 16px;
    border-bottom: 2px solid var(--lms-border);
    color: var(--lms-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.lms-table td {
    padding: 16px;
    border-bottom: 1px solid var(--lms-border);
    vertical-align: middle;
    color: var(--lms-text-primary);
    transition: background-color 0.2s;
}

.lms-table tr:last-child td {
    border-bottom: none;
}

.lms-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

.lms-table-name {
    font-weight: 600;
    color: var(--lms-text-primary);
    display: block;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.lms-table-sub {
    font-size: 0.8rem;
    color: var(--lms-text-muted);
    display: block;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.4);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-section {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Modals */

.lms-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

/* Helper to show modal via JS since display:flex needed for centering */
.lms-modal[style*="display: block"] {
    display: flex !important;
}

.lms-modal-content {
    background: #1e293b;
    border: 1px solid var(--lms-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    position: relative;
    width: 100%;
    max-width: 600px;
    /* Reasonable max width */
    margin: 20px;
    padding: 24px;
    animation: fadeIn 0.2s ease-out;
}

.lms-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--lms-border);
    padding-bottom: 20px;
    margin-bottom: 24px;
}

.lms-close {
    color: var(--lms-text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.lms-close:hover {
    color: var(--lms-text-primary);
}

.lms-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--lms-border);
}


/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -12px;
    margin-left: -12px;
}

.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding-right: 12px;
    padding-left: 12px;
}

@media (max-width: 992px) {

    .col-md-6,
    .col-md-5,
    .col-md-7 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 24px;
    }
}

.col-md-5 {
    flex: 0 0 41.666667%;
    max-width: 41.666667%;
    padding-right: 12px;
    padding-left: 12px;
}

.col-md-7 {
    flex: 0 0 58.333333%;
    max-width: 58.333333%;
    padding-right: 12px;
    padding-left: 12px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--lms-surface);
    border: 1px solid var(--lms-border);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--lms-text-secondary);
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--lms-accent);
    border-color: var(--lms-accent);
}

input:checked+.slider:before {
    transform: translateX(24px);
    background-color: white;
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Utilities */
.me-2 {
    margin-right: 0.5rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

/* --- LMS Toggle Switch --- */
.lms-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.lms-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.lms-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--lms-bg-card);
    border: 1px solid var(--lms-border);
    transition: .4s;
    border-radius: 34px;
}

.lms-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: var(--lms-text-muted);
    transition: .4s;
    border-radius: 50%;
}

.lms-switch input:checked+.lms-slider {
    background-color: rgba(16, 185, 129, 0.2);
    border-color: var(--lms-success);
}

.lms-switch input:checked+.lms-slider:before {
    transform: translateX(30px);
    background-color: var(--lms-success);
    box-shadow: 0 0 10px var(--lms-success);
}

/* --- LMS Console & Status --- */
.lms-console {
    background-color: #020617;
    border: 1px solid var(--lms-border);
    border-radius: var(--lms-radius);
    padding: 1.25rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    color: var(--lms-text-secondary);
    height: 200px;
    overflow-y: auto;
    margin-top: 1rem;
}

.lms-status-card {
    background: var(--lms-bg-card);
    border: 1px solid var(--lms-border);
    padding: 1rem 1.5rem;
    border-radius: var(--lms-radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    backdrop-filter: blur(14px);
}