/**
 * Central Authentication System - Modern Minimalist Design
 * Brand Color: #5f96d7
 */

:root {
    --primary-color: #5f96d7;
    --primary-light: #7eaee3;
    --primary-dark: #4a7bb8;
    --primary-gradient: linear-gradient(135deg, #5f96d7 0%, #4a7bb8 100%);

    --bg-dark: #0d1117;
    --bg-card: #161b22;
    --bg-input: #0d1117;
    --border-color: #30363d;
    --border-light: #21262d;

    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;

    --success-color: #3fb950;
    --danger-color: #f85149;
    --warning-color: #d29922;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

/* Light Theme */
[data-bs-theme="light"] {
    --bg-dark: #f6f8fa;
    --bg-card: #ffffff;
    --bg-input: #f6f8fa;
    --border-color: #d0d7de;
    --border-light: #e6e8eb;

    --text-primary: #1f2328;
    --text-secondary: #656d76;
    --text-muted: #8c959f;

    --success-color: #1a7f37;
    --danger-color: #cf222e;
    --warning-color: #9a6700;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-bs-theme="light"] .alert-danger {
    background: rgba(207, 34, 46, 0.1);
    color: #a40e26;
}

[data-bs-theme="light"] .alert-success {
    background: rgba(26, 127, 55, 0.1);
    color: #116329;
}

[data-bs-theme="light"] .alert-dismissible .btn-close {
    filter: none;
}

[data-bs-theme="light"] input:-webkit-autofill,
[data-bs-theme="light"] input:-webkit-autofill:hover,
[data-bs-theme="light"] input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px #f6f8fa inset !important;
    -webkit-text-fill-color: #1f2328 !important;
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
}

.theme-toggle:hover {
    color: var(--text-primary);
    border-color: var(--primary-color);
    background: rgba(95, 150, 215, 0.1);
}

.theme-toggle i {
    font-size: 1.125rem;
}

/* Fixed corner position for login/forgot pages */
.theme-toggle.fixed-corner {
    position: fixed;
    top: 20px;
    right: 20px;
    margin: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ================================
   Login Page — Premium Redesign
   ================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    background: var(--bg-dark);
    overflow: hidden;
    position: relative;
}

/* Animated Background Orbs */
.login-bg-effects {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
    animation: orbFloat 18s ease-in-out infinite;
}

.orb-1 {
    width: 420px;
    height: 420px;
    background: var(--primary-color);
    top: -10%;
    left: -8%;
    animation-duration: 20s;
}

.orb-2 {
    width: 320px;
    height: 320px;
    background: #7c3aed;
    bottom: -5%;
    right: -5%;
    animation-duration: 24s;
    animation-delay: -6s;
}

.orb-3 {
    width: 260px;
    height: 260px;
    background: #06b6d4;
    top: 50%;
    left: 60%;
    animation-duration: 22s;
    animation-delay: -12s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(40px, -30px) scale(1.08); }
    50% { transform: translate(-20px, 40px) scale(0.95); }
    75% { transform: translate(30px, 20px) scale(1.04); }
}

[data-bs-theme="light"] .orb {
    opacity: 0.10;
}

.login-container {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card {
    background: rgba(22, 27, 34, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(48, 54, 61, 0.6);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

[data-bs-theme="light"] .login-card {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(208, 215, 222, 0.7);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header .logo-icon {
    margin-bottom: 1.25rem;
}

.login-header .logo-icon img {
    width: 58px;
    height: 58px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(95, 150, 215, 0.3));
    transition: transform 0.3s ease;
}

.login-header .logo-icon img:hover {
    transform: scale(1.08);
}

.login-header .logo-icon i {
    display: none;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
    letter-spacing: -0.03em;
}

.login-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.redirect-notice {
    background: rgba(95, 150, 215, 0.1);
    border: 1px solid rgba(95, 150, 215, 0.2);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.8125rem;
    color: var(--primary-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ================================
   Form Styles — Refined
   ================================ */
.login-form .form-label {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: block;
    letter-spacing: 0.01em;
}

.login-form .input-group {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.login-form .input-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(95, 150, 215, 0.12), 0 0 16px rgba(95, 150, 215, 0.06);
}

.login-form .input-group-text {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.75rem 0.875rem;
    padding-right: 0;
    transition: color 0.25s ease;
}

.login-form .input-group:focus-within .input-group-text {
    color: var(--primary-color);
}

.login-form .form-control {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.75rem;
    font-size: 0.9375rem;
}

.login-form .form-control:focus {
    background: transparent;
    box-shadow: none;
    outline: none;
}

.login-form .form-control::placeholder {
    color: var(--text-muted);
}

.login-form .btn-outline-secondary {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.75rem;
    transition: color 0.2s ease;
}

.login-form .btn-outline-secondary:hover {
    color: var(--text-primary);
    background: transparent;
}

.login-form .mb-3 {
    margin-bottom: 1.25rem !important;
}

.login-form .mb-4 {
    margin-bottom: 1.5rem !important;
}

/* Primary Button — Gradient */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    color: white;
    padding: 0.875rem 1.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(95, 150, 215, 0.35), 0 2px 8px rgba(95, 150, 215, 0.2);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(95, 150, 215, 0.25);
}

.btn-primary:disabled {
    opacity: 0.6;
    transform: none;
    cursor: not-allowed;
    box-shadow: none;
}

/* Footer Links — Clean Layout */
.login-footer-links {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
}

.footer-link-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-size: 0.875rem;
}

.footer-link-row + .footer-link-row {
    margin-top: 0.5rem;
}

.footer-link-row .text-muted {
    color: var(--text-muted) !important;
}

.login-card .login-footer-links a[href],
.login-card .footer-link-row a[href],
a.action-link,
a.action-link:link,
a.action-link:visited,
a.action-link:hover,
a.action-link:focus,
a.action-link:active {
    color: var(--primary-color) !important;
    text-decoration: none !important;
    text-decoration-line: none !important;
    font-weight: 600;
    transition: color 0.2s ease;
}

.login-card .login-footer-links a[href]:hover,
.login-card .footer-link-row a[href]:hover,
a.action-link:hover {
    color: var(--primary-light) !important;
    text-decoration: none !important;
    text-decoration-line: none !important;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ================================
   Logout Page
   ================================ */
.logout-content {
    padding: 2rem 0;
}

.logout-icon {
    font-size: 4rem;
    color: var(--success-color);
    margin-bottom: 1.5rem;
}

.logout-content h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.logout-actions {
    margin-top: 2rem;
}

/* ================================
   Dashboard Page
   ================================ */
.dashboard-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0.875rem 0;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text-primary) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand i {
    color: var(--primary-color);
}

.nav-link {
    color: var(--text-secondary) !important;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem !important;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--text-primary) !important;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    min-width: 200px;
}

.dropdown-item {
    color: var(--text-primary);
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-item:hover {
    background: rgba(95, 150, 215, 0.1);
    color: var(--text-primary);
}

.dropdown-item.text-danger {
    color: var(--danger-color) !important;
}

.dropdown-item.text-danger:hover {
    background: rgba(248, 81, 73, 0.1);
}

.dropdown-divider {
    border-color: var(--border-color);
    margin: 0.375rem 0;
}

.dropdown-item-text {
    padding: 0.5rem 0.875rem;
}

.dashboard-header {
    padding: 3rem 0 2rem;
}

.dashboard-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.dashboard-header .lead {
    font-size: 1rem;
}

/* ================================
   App Cards
   ================================ */
.app-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.25s ease;
    height: 100%;
}

.app-card:hover {
    transform: translateY(-4px);
    border-color: var(--app-color, var(--primary-color));
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
}

.app-icon {
    width: 52px;
    height: 52px;
    background: var(--app-color, var(--primary-color));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.app-icon i {
    font-size: 1.5rem;
    color: white;
}

.app-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    letter-spacing: -0.01em;
}

.app-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.app-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--app-color, var(--primary-color));
    font-size: 0.875rem;
    font-weight: 500;
}

.app-link i {
    transition: transform 0.2s;
}

.app-card:hover .app-link i {
    transform: translateX(4px);
}

/* ================================
   Footer
   ================================ */
.footer {
    margin-top: auto;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
}

/* ================================
   Alerts
   ================================ */
.alert {
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    margin-bottom: 1.5rem;
    border: none;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-danger {
    background: rgba(248, 81, 73, 0.12);
    color: #ffa198;
}

.alert-success {
    background: rgba(63, 185, 80, 0.12);
    color: #7ee787;
}

.alert-dismissible .btn-close {
    filter: invert(1);
    opacity: 0.5;
}

/* ================================
   Form Controls (General)
   ================================ */
.form-select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 0.625rem 0.875rem;
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(95, 150, 215, 0.15);
    background-color: var(--bg-input);
    color: var(--text-primary);
}

.form-check-input {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(95, 150, 215, 0.15);
    border-color: var(--primary-color);
}

/* ================================
   Buttons (Secondary)
   ================================ */
.btn-outline-secondary {
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* ================================
   Responsive
   ================================ */
@media (max-width: 576px) {
    .login-card {
        padding: 1.75rem;
    }

    .dashboard-header h1 {
        font-size: 1.5rem;
    }

    .app-card {
        padding: 1.5rem;
    }
}

/* ================================
   Form Autofill Fix
   ================================ */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px var(--bg-input) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    caret-color: var(--text-primary);
    transition: background-color 5000s ease-in-out 0s;
}

/* ================================
   Scrollbar
   ================================ */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ================================
   Admin Styles
   ================================ */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.user-list {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.user-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
    transition: background 0.2s;
}

.user-item:last-child {
    border-bottom: none;
}

.user-item:hover {
    background: rgba(95, 150, 215, 0.08);
}

.user-item.active {
    background: rgba(95, 150, 215, 0.15);
    border-left: 3px solid var(--primary-color);
}

.role-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}

.role-card.custom {
    border-color: var(--primary-color);
}

.badge {
    font-weight: 500;
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius-sm);
}

.badge.bg-primary {
    background: var(--primary-color) !important;
}

.badge.bg-secondary {
    background: var(--border-color) !important;
    color: var(--text-secondary);
}