/* Reusable Components */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    touch-action: manipulation;
    user-select: none;
    white-space: nowrap;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(var(--primary-rgb), 0.3);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-dark);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-light {
    background: var(--light);
    color: var(--dark);
    border: 1px solid var(--border-color);
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Navbar - Clean Flexbox Layout */
#navbar-container {
    width: 100%;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 1001;
}

#navbar-container .navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
}

.navbar {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    padding: 0 20px; /* Reduced padding */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 1000;
    height: var(--navbar-height, 60px); /* Use CSS variable for height */
}

/* Navbar height variable used to offset page content to avoid overlap */
.navbar { --navbar-height: 60px; }

/* When navbar is present add top offset to main containers to avoid overlap */
.has-navbar .main-content,
.has-navbar .container,
.has-navbar .auth-page,
.has-navbar .register-page,
.has-navbar .login-page,
.has-navbar #dashboardSection,
.has-navbar .dashboard-page,
.has-navbar .dashboard {
    padding-top: calc(var(--navbar-height) + 20px) !important; /* Adjusted offset */
}

.navbar-brand {
    font-size: 15px;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    line-height: 1;
    padding: 0;
    margin: 0;
}

.navbar-brand:hover {
    opacity: 0.8;
}

.navbar-brand .brand-mark {
    width: 36px; /* Smaller */
    height: 36px; /* Smaller */
    border-radius: 6px; /* Slightly smaller radius */
    font-size: 16px; /* Smaller font */
}
.navbar-brand .brand-title {
    margin-left: 8px; /* Adjusted margin */
    font-size: 17px; /* Adjusted font size */
}

/* Navbar Links */
.navbar-nav {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.nav-link {
    color: var(--light);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1;
    margin: 0;
}

.nav-link:hover {
    background: rgba(67, 97, 238, 0.1);
}

.nav-link.active {
    background: var(--primary);
}

/* Navbar toggle (hamburger) for mobile */
.navbar-toggle {
    background: transparent;
    border: none;
    color: var(--light);
    font-size: 20px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    margin-left: 15px; /* Added margin to separate from profile toggle */
}

.navbar-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.mobile-nav {
    display: none;
    position: fixed;
    top: var(--navbar-height, 60px); /* Position below navbar */
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 20px;
    flex-direction: column;
    gap: 8px;
    z-index: 999;
}

.mobile-nav.active {
    display: flex;
}

.mobile-nav .nav-link {
    padding: 12px 16px;
    border-radius: 6px;
}

/* Mobile navbar adjustments */
@media (max-width: 768px) {
    .navbar {
        padding: 12px 15px;
    }
    
    .navbar-brand {
        font-size: 18px;
    }
    
    .navbar-brand i {
        font-size: 16px;
    }
    
    .desktop-only { 
        display: none !important; 
    }

    .how-to-use-link-desktop,
    .navbar-right-menu {
        display: none !important;
    }
    
    .mobile-only { 
        display: inline-flex !important; 
    }
    
    .navbar-toggle {
        padding: 8px 12px;
        font-size: 18px;
    }
    
    .mobile-nav {
        width: 100%;
        gap: 6px;
    }
    
    .mobile-nav .nav-link {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .has-navbar .main-content,
    .has-navbar .container,
    .has-navbar .auth-page,
    .has-navbar .register-page,
    .has-navbar .login-page {
        padding-top: 120px !important;
    }
}

@media (min-width: 769px) {
    .navbar-toggle { 
        display: none !important; 
    }
    .mobile-nav { 
        display: none !important; 
    }
        .desktop-hidden {
            display: none !important;
        }
    
        /* .mobile-only was made hidden globally */
}

/* Ensure brand and nav items are vertically centered */
.navbar > * { 
    display: flex; 
    align-items: center; 
}

/* Refined brand and controls */
.navbar-brand {
    text-decoration: none;
    color: var(--light);
}
.navbar-brand .brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-size: 18px;
}
.navbar-brand .brand-title {
    font-weight: 800;
    margin-left: 10px;
    letter-spacing: -0.3px;
    font-size: 18px;
}

.navbar-controls {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.profile-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.06);
    background: transparent;
    color: var(--light);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    margin: 0;
}
.logout-btn:hover {
    background: rgba(255,255,255,0.03);
}

/* Mobile nav visibility controlled by .active */
.mobile-nav {
    display: none;
}
.mobile-nav.active {
    display: flex;
}


/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.card-body {
    color: var(--text-muted);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
    letter-spacing: -0.2px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
    background: var(--input-bg);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled {
    background: var(--disabled-bg);
    cursor: not-allowed;
}

/* Modal form styling */
.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

.modal-body .form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 15px;
    transition: all 0.2s ease;
}

.modal-body .form-control:hover {
    border-color: rgba(var(--primary-rgb), 0.5);
}

.modal-body .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
    background: var(--input-bg);
}

/* Ensure plain inputs/selects/textarea without .form-control still get styled */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 15px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.08);
}

/* Dropdown and option styling for visibility */
select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e6eef8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

select option {
    background: var(--darker);
    color: var(--text-color);
    padding: 10px;
    border: none;
    border-radius: 0;
}

select option:hover {
    background: var(--card-bg);
    color: var(--primary);
}

select option:checked {
    background: var(--primary);
    color: white;
}

/* Specific styling to ensure auth page inputs look clear and professional */
.auth-container {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: var(--border-radius);
    padding: 40px 30px;
    width: 100%;
    max-width: 420px;
    margin: 20px auto;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

@media (max-width: 480px) {
    .auth-container {
        padding: 30px 20px;
        margin: 20px auto;
        width: 95%;
    }
}

.auth-container input,
.auth-container select,
.auth-container textarea {
    background: rgba(0, 0, 0, 0.25);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 15px;
    border-radius: var(--border-radius-sm);
    box-sizing: border-box;
    font-size: 16px; /* Prevents iOS zoom on focus */
    transition: all 0.3s ease;
}

.auth-container input:focus,
.auth-container select:focus,
.auth-container textarea:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.25);
    outline: none;
}

.auth-container label {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    display: block;
}

/* Ensure auth forms are constrained and inputs don't stretch full viewport */
.auth-container form,
.auth-container form .form-group {
    max-width: 540px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.auth-container form input,
.auth-container form select,
.auth-container form textarea {
    max-width: 540px;
    width: 100%;
    display: block;
}

/* Auth Footer Links - High Visibility & Premium Look */
.footer-links {
    margin-top: 1.5rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-links p {
    margin: 0;
    opacity: 0.9;
}

.footer-links button,
.footer-links a {
    background: transparent;
    border: none;
    color: #60a5fa; /* Premium blue */
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
    font-size: inherit;
    transition: all 0.2s ease;
    display: inline-block;
    margin-left: 5px;
}

.footer-links button:hover,
.footer-links a:hover {
    background: transparent;
    color: #93c5fd;
    border-color: transparent;
    box-shadow: none;
    text-decoration: underline;
    transform: none;
}

.form-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 5px;
}

.form-control-static {
    display: block;
    padding: 12px 15px;
    color: var(--text-color);
    background: rgba(var(--primary-rgb), 0.05);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: var(--border-radius-sm);
    font-size: 15px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.form-check-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    user-select: none;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

.alert i {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert p {
    margin: 0;
    flex: 1;
}

.alert-success {
    background: rgba(var(--success-rgb), 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-warning {
    background: rgba(var(--warning-rgb), 0.1);
    border: 1px solid var(--warning);
    color: var(--warning);
}

.alert-error {
    background: rgba(var(--error-rgb), 0.1);
    border: 1px solid var(--error);
    color: var(--error);
}

.alert-info {
    background: rgba(var(--info-rgb), 0.1);
    border: 1px solid var(--info);
    color: var(--info);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal.active {
    display: flex;
    animation: fadeInBackdrop 0.3s ease;
}

@keyframes fadeInBackdrop {
    from {
        background: rgba(0, 0, 0, 0);
        backdrop-filter: blur(0px);
    }
    to {
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(8px);
    }
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 1px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 22px;
    color: var(--text-color);
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    padding: 0;
}

.modal-close:hover {
    background: rgba(var(--error-rgb), 0.1);
    color: var(--error);
    transform: rotate(90deg);
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: rgba(var(--error-rgb), 0.1);
    color: var(--error);
}

.modal-body {
    margin-bottom: 25px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.table th {
    background: var(--table-header-bg);
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
    font-size: 14px;
}

.table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 14px;
}

.table tr:hover {
    background: var(--table-hover-bg);
}

.table-striped tbody tr:nth-child(odd) {
    background: var(--table-stripe-bg);
}

.table-responsive {
    overflow-x: auto;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
}

.badge-success {
    background: rgba(var(--success-rgb), 0.1);
    color: var(--success);
    border: 1px solid rgba(var(--success-rgb), 0.3);
}

.badge-warning {
    background: rgba(var(--warning-rgb), 0.1);
    color: var(--warning);
    border: 1px solid rgba(var(--warning-rgb), 0.3);
}

.badge-danger {
    background: rgba(var(--error-rgb), 0.1);
    color: var(--error);
    border: 1px solid rgba(var(--error-rgb), 0.3);
}

.badge-info {
    background: rgba(var(--info-rgb), 0.1);
    color: var(--info);
    border: 1px solid rgba(var(--info-rgb), 0.3);
}

/* Navigation */
.nav-tabs {
    display: flex;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 5px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.nav-tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    min-width: 120px;
}

.nav-tab:hover {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

.nav-tab.active {
    background: var(--primary);
    color: white;
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    background: var(--dark);
    color: white;
    text-align: center;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--dark) transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

/* --- Window Controls Overlay for PWA on Desktop --- */
@media (display-mode: window-controls-overlay) {
    /* Make the navbar a draggable region, like a native title bar */
    #navbar-container .navbar {
        app-region: drag;
        /* These paddings create a "safe area" for content, pushing it away from
           the window controls (minimize, maximize, close) on either left or right. */
        padding-left: env(titlebar-area-x, 20px);
        padding-right: calc(100vw - env(titlebar-area-width, 100vw) - env(titlebar-area-x, 0px));
    }

    /* Make all interactive elements within the navbar non-draggable so they remain clickable */
    .navbar-brand,
    .navbar-nav,
    .nav-link,
    .navbar-toggle,
    .navbar-controls,
    .user-profile,
    .logout-btn,
    .nav-auth-btn,
    .btn,
    .dropdown-toggle,
    .profile-placeholder {
        app-region: no-drag;
    }
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mt-0 { margin-top: 0; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-0 { margin-bottom: 0; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.ml-10 { margin-left: 10px; }
.mr-10 { margin-right: 10px; }

.p-0 { padding: 0; }
.p-10 { padding: 10px; }
.p-20 { padding: 20px; }
.p-30 { padding: 30px; }

.w-100 { width: 100%; }
.w-50 { width: 50%; }
.w-75 { width: 75%; }

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

.mobile-only { display: none !important; }
@media (min-width: 769px) {
    .desktop-only { display: flex !important; }
}

.flex-column { flex-direction: column; }
.flex-row { flex-direction: row; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.align-start { align-items: flex-start; }
.align-end { align-items: flex-end; }

.gap-5 { gap: 5px; }
.gap-10 { gap: 10px; }
.gap-15 { gap: 15px; }
.gap-20 { gap: 20px; }

/* Responsive Utilities */
@media (max-width: 768px) {
    .mobile-hidden {
        display: none !important;
    }

    .mobile-full-width {
        width: 100% !important;
    }

    .mobile-stack {
        flex-direction: column !important;
    }
}

@media (min-width: 769px) {
    .desktop-hidden {
        display: none !important;
    }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 80px; /* Increased to match navbar height */
}

/* Main content spacing when navbar is fixed */
.main-content {
    /* padding-top: 84px; */
}

/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -10px;
}

.col {
    flex: 1;
    padding: 10px;
    min-width: 300px;
}

.col-1 { flex: 0 0 8.33%; }
.col-2 { flex: 0 0 16.66%; }
.col-3 { flex: 0 0 25%; }
.col-4 { flex: 0 0 33.33%; }
.col-5 { flex: 0 0 41.66%; }
.col-6 { flex: 0 0 50%; }
.col-7 { flex: 0 0 58.33%; }
.col-8 { flex: 0 0 66.66%; }
.col-9 { flex: 0 0 75%; }
.col-10 { flex: 0 0 83.33%; }
.col-11 { flex: 0 0 91.66%; }
.col-12 { flex: 0 0 100%; }

/* Tabs */
.tabs {
    width: 100%;
}

.tabs-header {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    background: var(--darker);
    border-radius: var(--border-radius);
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
}

.tab-btn {
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    white-space: nowrap;
    color: var(--gray-lighter);
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.tabs-content {
    width: 100%;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

/* Accordion */
.accordion {
    width: 100%;
}

.accordion-item {
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    padding: 15px 20px;
    background: var(--darker);
    border: none;
    color: var(--light);
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.accordion-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.accordion-header.active {
    background: var(--primary);
}

.accordion-header.active .fa-chevron-down {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
}

.accordion-content.active {
    padding: 20px;
    max-height: 1000px;
}

/* Tooltips */
.tooltip {
    position: absolute;
    background: var(--dark);
    color: white;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-sm);
    white-space: nowrap;
    z-index: var(--z-tooltip);
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--dark);
}

.tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

/* Toast Container */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: var(--darker);
    color: white;
    padding: 15px 20px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow);
}

.toast-success {
    background: var(--success);
    border-color: var(--success);
}

.toast-error {
    background: var(--error);
    border-color: var(--error);
}

.toast-warning {
    background: var(--warning);
    border-color: var(--warning);
}

.toast-info {
    background: var(--info);
    border-color: var(--info);
}

.toast-icon {
    font-size: 18px;
}

.toast-message {
    flex: 1;
    font-size: var(--font-size-sm);
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.7;
    transition: var(--transition);
    padding: 4px;
    border-radius: 4px;
}

.toast-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.exiting {
    animation: slideOutRight 0.3s ease forwards;
}

/* Loading Indicator */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    flex-direction: column;
    gap: 20px;
}

.loading-indicator.active {
    display: flex;
}

.loading-indicator .loading-spinner {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

.loading-indicator .loading-message {
    color: white;
    font-size: var(--font-size-lg);
    font-weight: 600;
}

/* Level Selection Modal */
.level-option {
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    margin-bottom: 15px;
    cursor: pointer;
    transition: var(--transition);
}

.level-option:hover {
    background: rgba(67, 97, 238, 0.1);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.level-option h4 {
    color: var(--light);
    margin-bottom: 5px;
    font-size: var(--font-size-lg);
}

.level-option p {
    color: var(--gray-light);
    font-size: var(--font-size-sm);
}

/* Offline Indicator */
#offlineIndicator {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    background: var(--warning);
    color: var(--dark);
    text-align: center;
    padding: 10px;
    font-weight: 600;
    z-index: var(--z-fixed);
    display: none;
    animation: slideDown 0.3s ease-out;
}

#offlineIndicator.active {
    display: block;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Loading Indicator */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    flex-direction: column;
    gap: 20px;
}

.loading-indicator.active {
    display: flex;
}

.loading-indicator .loading-spinner {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

.loading-indicator .loading-message {
    color: white;
    font-size: var(--font-size-lg);
    font-weight: 600;
}

/* Level Selection Modal */
.level-option {
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    margin-bottom: 15px;
    cursor: pointer;
    transition: var(--transition);
}

.level-option:hover {
    background: rgba(67, 97, 238, 0.1);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.level-option h4 {
    color: var(--light);
    margin-bottom: 5px;
    font-size: var(--font-size-lg);
}

.level-option p {
    color: var(--gray-light);
    font-size: var(--font-size-sm);
}

/* Offline Indicator */
#offlineIndicator {
    position: fixed;
    top: var(--navbar-height, 60px); /* Position it right below the navbar */
    left: 0;
    right: 0;
    width: 100%;
    background: var(--warning);
    color: var(--dark);
    text-align: center;
    padding: 10px;
    font-weight: 600;
    z-index: var(--z-fixed);
    display: none;
    animation: slideDown 0.5s ease-out;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#offlineIndicator i {
    margin-right: 8px;
}

#offlineIndicator.active {
    display: block;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--darker);
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--light);
}

.modal-close {
    background: var(--error);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: #dc2626;
    transform: rotate(90deg);
}

.modal-body {
    margin-bottom: 30px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* New, Professional Navbar User Profile Styles */
.navbar-menu {
    grid-column: 2;
    justify-self: center;
    display: flex;
    gap: 15px;
}

.navbar-user {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border-radius: var(--border-radius);
    transition: background-color 0.3s ease;
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.1);
}

.profile-image {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--primary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark);
    font-weight: 600;
    color: var(--light);
}

.profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    color: var(--light);
    line-height: 1.3;
}

.user-name {
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
}

.user-role {
    font-size: 12px;
    color: var(--gray-light);
    text-transform: capitalize;
}

.dropdown-toggle {
    background: none;
    border: none;
    color: var(--gray-light);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    transition: color 0.3s ease, transform 0.3s ease;
}

.user-profile:hover .dropdown-toggle {
    color: var(--light);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--darker);
    border-radius: var(--border-radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 240px;
    z-index: 1001;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu.show + .dropdown-toggle {
    transform: rotate(180deg);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--gray-lighter);
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--primary);
    color: white;
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--gray-light);
    transition: color 0.2s ease;
}

.dropdown-item:hover i {
    color: white;
}

.dropdown-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

.logout-btn {
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* Skeleton loader for user profile */
.user-profile-skeleton {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
}

.profile-image-skeleton {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
}

.user-info-skeleton {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-line {
    width: 100px;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.skeleton-line.short {
    width: 60px;
}

/* Bottom Tab Bar for Mobile */
.bottom-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px; /* Standard iOS tab bar height */
    background: rgba(15, 23, 42, 0.9); /* Slightly more transparent */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-around;
    align-items: flex-start; /* Align items to the top of the container */
    padding-top: 8px; /* Padding for icons and text */
    z-index: 1000;
}

.bottom-tab-bar .tab-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    background: none;
    border: none;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
    flex-grow: 1;
    line-height: 1;
}

.bottom-tab-bar .tab-link:hover {
    color: var(--light);
}

.bottom-tab-bar .tab-link.active {
    color: var(--primary);
}

.bottom-tab-bar .tab-link i {
    font-size: 20px;
    margin-bottom: 2px; /* Space between icon and text */
}

/* Ensure the old mobile nav is always hidden */
.mobile-nav {
    display: none !important;
}

/* Override and refine mobile-only display */
@media (max-width: 768px) {
    .mobile-only {
        display: flex !important; /* Use flex for the tab bar and other elements */
    }

    /* Add padding to body to prevent content from being hidden by the tab bar */
    body.has-navbar {
        padding-bottom: 65px !important; /* Match tab bar height */
    }
}

/* Hide tab bar on desktop */
@media (min-width: 769px) {
    .bottom-tab-bar {
        display: none !important;
    }
}

/* Fix for potential overflow issues on main content containers */
.main-content, .container, .auth-page, .dashboard-page {
    width: 100%;
    max-width: 100%; /* Ensure it does not exceed viewport */
    overflow-x: hidden;
}

.how-to-use-link {
    flex-grow: 2; /* Make it take up more space */
}

.how-to-use-link-desktop.hidden {
    display: none !important;
}

/* Premium Navbar Auth Buttons */
.nav-auth-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.nav-auth-btn.login {
    color: var(--light);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-auth-btn.login:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.nav-auth-btn.register {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

.nav-auth-btn.register:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.4);
}

@media (max-width: 768px) {
    .nav-auth-btn.register {
        display: none;
    }
    
    .nav-auth-btn.login {
        border: none;
        padding: 0.5rem;
        font-size: 1rem;
    }
}

/* --- Auth Wizard (Multi-step Form) Styles --- */

.wizard-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
    padding: 0 10px;
}

.wizard-progress::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 0;
    transform: translateY(-50%);
}

.progress-step {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--darker);
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.progress-step.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.2);
}

.progress-step.completed {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.wizard-content {
    position: relative;
    overflow: hidden;
}

.wizard-step {
    display: none;
    animation: fadeInSlide 0.4s ease forwards;
}

.wizard-step.active {
    display: block;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.wizard-actions {
    display: flex;
    gap: 10px;
    margin-top: 1.5rem;
}

.wizard-actions .btn {
    flex: 1;
}

.step-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--light);
    margin-bottom: 1.2rem;
    text-align: center;
}

/* School Search Suggestions */
.school-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    margin-top: 5px;
    background-color: #1e293b; /* Ensure solid background to cover input */
}

.school-suggestion {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.school-suggestion:last-child {
    border-bottom: none;
}

.school-suggestion:hover {
    background-color: rgba(67, 97, 238, 0.1);
    border-left: 3px solid var(--primary);
    padding-left: 13px;
}

.school-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(67, 97, 238, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
    overflow: hidden;
    font-size: 16px;
}

.school-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.school-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.school-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.2;
}

.school-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.school-code-badge {
    font-size: 11px;
    font-weight: 700;
    background: rgba(67, 97, 238, 0.15);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.school-location {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.school-suggestion .highlight {
    font-weight: 800;
    color: var(--primary);
    background: rgba(67, 97, 238, 0.1);
    padding: 0 2px;
    border-radius: 2px;
}

@media (max-width: 768px) {
    .school-suggestion {
        padding: 14px 16px;
    }
    .school-name {
        font-size: 16px;
    }
}
