/* Enhanced Pace LMS Styles with Dark Mode Support */

:root {
    /* Light Theme Colors */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --radius: 0.5rem;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
    --transition: all 0.3s ease;
}

/* Dark Theme Colors */
[data-theme="dark"] {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #94a3b8;
    --background-color: #0f172a;
    --card-background: #1e293b;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --success-color: #22c55e;
    --danger-color: #f87171;
    --warning-color: #fbbf24;
    --info-color: #60a5fa;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -2px rgb(0 0 0 / 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-color);
    font-weight: 600;
}

/* Theme Toggle Button */
.theme-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    background: var(--border-color);
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid var(--border-color);
}

.theme-toggle:hover {
    background: var(--secondary-color);
}

.theme-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

[data-theme="dark"] .theme-toggle-slider {
    transform: translateX(30px);
    background: var(--primary-color);
}

.theme-toggle-slider::before {
    content: '☀️';
}

[data-theme="dark"] .theme-toggle-slider::before {
    content: '🌙';
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.card {
    background: var(--card-background);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-weight: 500;
    text-align: center;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-size: 0.875rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background-color: var(--card-background);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--background-color);
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Login Page */
/* Redesigned Login Page (PACE LMS V2) */
.login-wrapper {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

@media (max-width: 480px) {
    .login-wrapper {
        padding: 1rem;
    }

    .login-card {
        max-width: 100%;
        width: 100%;
    }

    .login-logo-circle {
        width: 120px !important;
        height: 120px !important;
    }

    .login-welcome-text {
        font-size: 2rem !important;
    }

    .login-form-input {
        padding: 0.9rem 1rem 0.9rem 3.75rem !important;
        font-size: 0.9rem !important;
    }

    .login-input-icon {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.1rem !important;
    }
}

/* Subtle background glow effect */
.login-wrapper::before {
    display: none;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    z-index: 1;
    position: relative;
}

.login-logo-container {
    text-align: center;
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-logo-circle {
    width: 150px;
    height: 150px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    /* Softer shadow for white bg */
    border: 1px solid #f1f5f9;
    padding: 1rem;
}

.login-logo-circle img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.login-welcome-text {
    font-family: 'Inter', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    color: #1e293b;
    text-align: center;
    line-height: 1.2;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.login-input-group {
    position: relative;
    margin-bottom: 2rem;
}

.login-input-icon {
    position: absolute;
    left: 0;
    top: 28px;
    /* Fixed vertical centering logic for relative container */
    transform: translateY(-50%);
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    z-index: 2;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
}

.login-input-icon i {
    line-height: 1;
}

.login-form-input {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    padding: 1.1rem 1rem 1.1rem 4.25rem;
    color: #1e293b;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.login-form-input::placeholder {
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 500;
}

.login-form-input:focus {
    outline: none;
    background: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.1);
}

.login-submit-btn {
    width: 100%;
    background: #4facfe;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    border-radius: 35px;
    padding: 1rem;
    font-size: 1.125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 242, 254, 0.3);
}

.login-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px rgba(59, 130, 246, 0.4);
}

.login-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding: 0 0.5rem;
}

.login-footer-link {
    color: #475569;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.2s;
}

.login-footer-link:hover {
    color: #3b82f6;
}




/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    font-size: 0.875rem;
    transition: var(--transition);
    background-color: var(--card-background);
    color: var(--text-color);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input.error {
    border-color: var(--danger-color);
}

.form-input.success {
    border-color: var(--success-color);
}

.form-error {
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.5rem;
    display: none;
    text-align: center;
    font-weight: 500;
    width: 100%;
}

.form-input.error+.form-error {
    display: block;
}

/* Alerts */
.alert {
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border-color: #fee2e2;
}

[data-theme="dark"] .alert-danger {
    background-color: #7f1d1d;
    color: #fecaca;
    border-color: #991b1b;
}

.alert-success {
    background-color: #f0fdf4;
    color: #166534;
    border-color: #dcfce7;
}

[data-theme="dark"] .alert-success {
    background-color: #14532d;
    color: #bbf7d0;
    border-color: #166534;
}

.alert-info {
    background-color: #eff6ff;
    color: #1e40af;
    border-color: #dbeafe;
}

[data-theme="dark"] .alert-info {
    background-color: #1e3a8a;
    color: #bfdbfe;
    border-color: #1e40af;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0;
}

.branch-card {
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.branch-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, transparent 100%);
    opacity: 0;
    transition: var(--transition);
    border-radius: var(--radius);
    pointer-events: none;
}

.branch-card:hover::after {
    opacity: 0.1;
}

.branch-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

th {
    background-color: var(--background-color);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    font-size: 0.875rem;
    color: var(--text-color);
}

tr:hover {
    background-color: var(--background-color);
    transition: background-color 0.2s;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: calc(var(--radius) * 0.5);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

[data-theme="dark"] .badge-success {
    background-color: #14532d;
    color: #86efac;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

[data-theme="dark"] .badge-warning {
    background-color: #78350f;
    color: #fde68a;
}

.badge-primary {
    background-color: #dbeafe;
    color: #1e40af;
}

[data-theme="dark"] .badge-primary {
    background-color: #1e3a8a;
    color: #93c5fd;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

[data-theme="dark"] .badge-danger {
    background-color: #7f1d1d;
    color: #fca5a5;
}

/* Navbar */
.navbar {
    background: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    margin-bottom: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.nav-brand {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.25rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-user {
    font-size: 0.875rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: var(--text-color);
    color: var(--card-background);
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Search Bar */
.search-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    background-color: var(--card-background);
    color: var(--text-color);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

/* Export Button */
.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.export-btn svg {
    width: 16px;
    height: 16px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .navbar-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .container {
        padding: 0.75rem;
    }

    .filters {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    /* Stack Table Rows as Cards on Mobile */
    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        border: 1px solid var(--border-color);
        margin-bottom: 1rem;
        border-radius: var(--radius);
        background: var(--card-background);
        padding: 1rem;
        box-shadow: var(--shadow);
    }

    td {
        border: none;
        position: relative;
        padding-left: 50%;
        text-align: right;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border-bottom: 1px dashed var(--border-color);
    }

    td:last-child {
        border-bottom: none;
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }

    td:before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        text-align: left;
        position: absolute;
        left: 0;
    }

    /* Adjust buttons for touch */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }

    .btn-sm {
        min-height: 36px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {

    .btn,
    .form-input,
    .form-select {
        min-height: 44px;
    }

    .card {
        padding: 1.25rem;
    }
}

/* Print Styles */
@media print {

    .navbar,
    .btn,
    .filters,
    .theme-toggle {
        display: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid #000;
    }

    body {
        background: white;
        color: black;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection color */
::selection {
    background-color: var(--primary-color);
    color: white;
}