/* PTO Portal - Professional Theme
 * Color Palette: Blue/Teal Professional
 * Supports Light and Dark modes
 */

/* ============================================
   CSS Variables - Light Theme (Default)
   ============================================ */
:root {
    /* Brand Colors (Miho PTO) */
    --primary: #123B6D;
    /* Miho Navy */
    --primary-hover: #0E2A4E;
    --primary-light: #4c6fa1;
    /* Lighter navy for backgrounds */
    --primary-dark: #0a1f3d;

    /* Accent Colors */
    --accent: #F59E0B;
    /* Miho Amber */
    --accent-hover: #D97706;

    /* Secondary Colors */
    --secondary: #6B7280;
    /* Gray-500 */
    --secondary-hover: #4B5563;
    --secondary-light: #F3F4F6;

    /* Status Colors */
    --success: #10B981;
    --success-light: #ECFDF5;
    --warning: #F59E0B;
    --warning-light: #FFF7ED;
    --danger: #EF4444;
    --danger-light: #FEF2F2;
    --info: #3B82F6;
    --info-light: #EFF6FF;

    /* Neutral Colors */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    /* Gray-50 */
    --bg-tertiary: #F3F4F6;
    /* Gray-100 */
    --text-primary: #111827;
    /* Gray-900 */
    --text-secondary: #4B5563;
    /* Gray-600 */
    --text-muted: #6B7280;
    /* Gray-500 */
    --border-color: #E5E7EB;
    /* Gray-200 */
    --border-light: #F3F4F6;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;

    /* Spacing & Touch Targets */
    --touch-target: 44px;
    --radius-sm: 4px;
    --radius: 8px;
    /* Slightly tighter radius for "logistics" feel */
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Font Family managed in body */
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Dark Theme */
[data-theme="dark"] {
    --primary: #3B82F6;
    /* Lighter blue for dark mode readability */
    --primary-hover: #60A5FA;
    --primary-light: #1E3A8A;
    --primary-dark: #EFF6FF;

    --accent: #F59E0B;
    --accent-hover: #FBBF24;

    --secondary: #9CA3AF;
    --secondary-hover: #D1D5DB;
    --secondary-light: #374151;

    --success: #34D399;
    --success-light: #064E3B;
    --warning: #FBBF24;
    --warning-light: #78350F;
    --danger: #F87171;
    --danger-light: #7F1D1D;
    --info: #60A5FA;
    --info-light: #1E3A8A;

    --bg-primary: #0F172A;
    /* Slate-900 */
    --bg-secondary: #1E293B;
    /* Slate-800 */
    --bg-tertiary: #334155;
    /* Slate-700 */
    --text-primary: #F9FAFB;
    /* Gray-50 */
    --text-secondary: #E2E8F0;
    /* Slate-200 (Was Gray-300 #D1D5DB) */
    --text-muted: #CBD5E1;
    /* Slate-300 (Was Gray-400 #9CA3AF) */
    --border-color: #334155;
    /* Slate-700 */
    --border-light: #475569;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

/* ============================================
   Base Styles
   ============================================ */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition), color var(--transition);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
}

/* ============================================
   Typography
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.125rem;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

/* ============================================
   Layout Components
   ============================================ */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.main-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ============================================
   Navbar
   ============================================ */
.dashboard-hero {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .dashboard-hero {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.navbar-custom {
    background: var(--bg-primary) !important;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 1.5rem;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand svg {
    width: 32px;
    height: 32px;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary) !important;
    background: var(--primary-light);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Large avatar for profile modal */
.avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.75rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: capitalize;
    white-space: nowrap;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Stats Cards */
.stats-card {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    transition: all var(--transition);
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stats-card .stats-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stats-card .stats-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stats-card .stats-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stats-card.primary .stats-icon {
    background: var(--primary-light);
    color: var(--primary);
}

.stats-card.success .stats-icon {
    background: var(--success-light);
    color: var(--success);
}

.stats-card.warning .stats-icon {
    background: var(--warning-light);
    color: var(--warning);
}

.stats-card.info .stats-icon {
    background: var(--info-light);
    color: var(--info);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: white;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: #1e293b;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-outline-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-icon {
    padding: 0.5rem;
    width: 40px;
    height: 40px;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

/* ============================================
   Forms
   ============================================ */
.form-control,
.form-select {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.form-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-group {
    margin-bottom: 1rem;
}

/* Input with icon */
.input-group-icon {
    position: relative;
}

.input-group-icon .form-control {
    padding-left: 2.5rem;
}

.input-group-icon .input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Password toggle */
.password-toggle {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
}

.password-toggle:hover {
    color: var(--text-secondary);
}

/* Validation states */
.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-valid {
    border-color: var(--success);
}

.invalid-feedback {
    color: var(--danger);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

/* ============================================
   Tables
   ============================================ */
.table-container {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
    color: var(--text-primary);
}

.table thead th {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 0.875rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--bg-secondary);
}

.table-striped tbody tr:nth-of-type(odd) {
    background: var(--bg-secondary);
}

/* Responsive table on mobile */
@media (max-width: 768px) {
    .table-responsive-cards .table thead {
        display: none;
    }

    .table-responsive-cards .table tbody tr {
        display: block;
        margin-bottom: 1rem;
        background: var(--bg-primary);
        border-radius: var(--radius);
        border: 1px solid var(--border-color);
        padding: 1rem;
    }

    .table-responsive-cards .table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border: none;
    }

    .table-responsive-cards .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
    }
}

/* ============================================
   Badges & Status
   ============================================ */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-pending {
    background: var(--warning-light);
    color: #92400e;
}

.badge-approved {
    background: var(--success-light);
    color: #065f46;
}

.badge-denied {
    background: var(--danger-light);
    color: #991b1b;
}

.badge-admin {
    background: var(--secondary-light);
    color: #4338ca;
}

.badge-manager {
    background: var(--info-light);
    color: #1d4ed8;
}

.badge-employee {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

[data-theme="dark"] .badge-pending {
    color: var(--warning);
}

[data-theme="dark"] .badge-approved {
    color: var(--success);
}

[data-theme="dark"] .badge-denied {
    color: var(--danger);
}

/* ============================================
   Modals
   ============================================ */
.modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

.btn-close {
    filter: var(--text-primary);
}

[data-theme="dark"] .btn-close {
    filter: invert(1);
}

/* ============================================
   Tabs
   ============================================ */
.nav-tabs-custom {
    border-bottom: 1px solid var(--border-color);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.nav-tabs-custom .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    background: none;
}

.nav-tabs-custom .nav-link:hover {
    color: var(--primary);
    background: none;
    border-bottom-color: var(--border-color);
}

.nav-tabs-custom .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: none;
}

/* Pills tabs */
.nav-pills-custom {
    background: var(--bg-tertiary);
    padding: 0.25rem;
    border-radius: var(--radius);
    display: inline-flex;
    gap: 0.25rem;
}

.nav-pills-custom .nav-link {
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-pills-custom .nav-link.active {
    background: var(--bg-primary);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ============================================
   Calendar
   ============================================ */
.calendar-container {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.calendar-title {
    font-weight: 600;
    font-size: 1.125rem;
}

.calendar-nav {
    display: flex;
    gap: 0.5rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day-header {
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.calendar-day {
    min-height: 100px;
    padding: 0.5rem;
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}

.calendar-day:nth-child(7n) {
    border-right: none;
}

.calendar-day:hover {
    background: var(--bg-secondary);
}

.calendar-day.other-month {
    background: var(--bg-tertiary);
    opacity: 0.5;
}

.calendar-day.today {
    background: var(--primary-light);
}

.calendar-day-number {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.calendar-event {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.calendar-event.approved {
    background: var(--success-light);
    color: #065f46;
}

.calendar-event.pending {
    background: var(--warning-light);
    color: #92400e;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    color: var(--success);
}

.toast-error .toast-icon {
    color: var(--danger);
}

.toast-warning .toast-icon {
    color: var(--warning);
}

.toast-info .toast-icon {
    color: var(--info);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
}

.toast-message {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    margin: -0.25rem;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* ============================================
   Loading States
   ============================================ */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: var(--bg-primary);
    opacity: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

.skeleton {
    background: linear-gradient(90deg,
            var(--bg-tertiary) 25%,
            var(--border-color) 50%,
            var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
}

/* ============================================
   Login Page
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--bg-secondary) 100%);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    text-align: center;
    padding: 2rem 2rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.login-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: white;
}

.login-subtitle {
    opacity: 0.9;
    font-size: 0.9375rem;
}

.login-form {
    padding: 2rem;
}

.login-footer {
    text-align: center;
    padding: 1rem 2rem 2rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ============================================
   Theme Toggle
   ============================================ */
.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.25rem;
    display: flex;
    cursor: pointer;
}

.theme-toggle-option {
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.theme-toggle-option.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ============================================
   Utilities
   ============================================ */
.text-adaptive {
    color: var(--text-primary) !important;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 0.75rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.rounded {
    border-radius: var(--radius);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-full {
    border-radius: 9999px;
}

.shadow {
    box-shadow: var(--shadow);
}

.shadow-md {
    box-shadow: var(--shadow-md);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   Responsive Breakpoints
   ============================================ */
@media (max-width: 576px) {
    .main-content {
        padding: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .stats-card {
        padding: 1rem;
    }

    .stats-card .stats-value {
        font-size: 1.5rem;
    }

    .btn {
        padding: 0.625rem 1rem;
    }

    .modal-body {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .navbar-custom {
        padding: 0.5rem 1rem;
    }

    .user-info {
        display: none;
    }

    .calendar-day {
        min-height: 60px;
    }

    .calendar-event {
        font-size: 0.625rem;
        padding: 0.125rem 0.25rem;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {

    .navbar-custom,
    .theme-toggle,
    .btn,
    .toast-container {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ============================================
   Pattern Background & Visual Enhancements
   ============================================ */

/* Subtle pattern overlay for main content */
.main-content {
    position: relative;
}

.main-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary-light) 100%);
    opacity: 0.3;
    z-index: -1;
    pointer-events: none;
}

/* Brand logo styling */
.brand-logo {
    transition: transform var(--transition);
}

.navbar-brand:hover .brand-logo {
    transform: scale(1.05);
}

/* Empty state illustrations */
.empty-state-illustration {
    opacity: 0.9;
    transition: transform var(--transition);
}

.empty-state:hover .empty-state-illustration {
    transform: scale(1.02);
}

/* Enhanced card headers with subtle gradient */
.card-header {
    position: relative;
    overflow: hidden;
}

.card-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity var(--transition);
}

.card:hover .card-header::after {
    opacity: 1;
}

/* Stats card enhancements */
.stats-card {
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-slow);
    pointer-events: none;
}

.stats-card:hover::before {
    opacity: 0.5;
}

/* Button hover enhancements */
.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn-primary:hover::after {
    width: 300px;
    height: 300px;
}

/* User avatar pulse animation for new notifications */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.user-avatar.has-notification {
    animation: pulse 2s infinite;
}

/* ============================================
   Bootstrap Overrides for Dark Mode
   ============================================ */
.text-muted {
    color: var(--text-muted) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .bg-white {
    background-color: var(--bg-primary) !important;
}

[data-theme="dark"] .bg-light {
    background-color: var(--bg-tertiary) !important;
}

[data-theme="dark"] .border {
    border-color: var(--border-color) !important;
}

/* Explicit Dark Mode Overrides to fix visibility issues */
[data-theme="dark"] .card {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .text-secondary {
    color: var(--text-secondary) !important;
}

/* Global Table Overrides for Dark Mode */
[data-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .table td,
[data-theme="dark"] .table th {
    background-color: transparent !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: var(--bg-tertiary) !important;
}

[data-theme="dark"] .table .text-muted {
    color: var(--text-muted) !important;
}

/* Fix for .btn-white in Dark Mode */
.btn-white {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .btn-white {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .btn-white:hover {
    background: var(--bg-secondary);
}

/* Nuclear Option: Force ALL text in dark mode tables to be readable */
[data-theme="dark"] .table * {
    color: var(--text-primary);
}

[data-theme="dark"] .table .text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .table .badge {
    color: white !important;
    /* Badges should stay white-text */
}

/* Global Text Default for Dark Mode */
[data-theme="dark"] body {
    color: var(--text-primary);
}

/* Fix for .text-dark utility in Dark Mode (Admin Header) */
[data-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}

/* Fix for .btn-outline-secondary in Dark Mode (Calendar Export, Billing) */
[data-theme="dark"] .btn-outline-secondary {
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

/* Fix for Accordions (Settings > Integrations) */
[data-theme="dark"] .accordion-item {
    background-color: transparent;
    border-color: var(--border-color);
}

[data-theme="dark"] .accordion-button {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    box-shadow: none;
    /* remove blue focus ring style if present */
}

[data-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: var(--bg-secondary);
    color: var(--primary);
    box-shadow: inset 0 -1px 0 var(--border-color);
}

[data-theme="dark"] .accordion-button::after {
    filter: invert(1);
    /* Invert the arrow icon to make it white */
}

/* Ensure Admin Tables Text is readable */
[data-theme="dark"] .admin-container h1,
[data-theme="dark"] .admin-container h2,
[data-theme="dark"] .admin-container h3,
[data-theme="dark"] .admin-container h4,
[data-theme="dark"] .admin-container h5,
[data-theme="dark"] .admin-container h6 {
    color: var(--text-primary) !important;
}

/* Fix for form controls in Dark Mode (Admin Inputs) */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--text-primary);
}

/* Fix for Danger Zone Card (Settings) */
[data-theme="dark"] .bg-danger-subtle {
    background-color: rgba(220, 53, 69, 0.1) !important;
    /* Dark red tint */
    border-color: rgba(220, 53, 69, 0.2) !important;
}

[data-theme="dark"] .text-danger-emphasis {
    color: #fca5a5 !important;
    /* Light red (Tailwind red-300 equivalent) */
}

[data-theme="dark"] .btn-outline-danger.bg-white {
    background-color: transparent !important;
    color: #fca5a5;
    border-color: #fca5a5;
}

[data-theme="dark"] .btn-outline-danger.bg-white:hover {
    background-color: rgba(220, 53, 69, 0.2) !important;
}

/* ============================================
   Dark Mode Utility Overrides (Badges, Alerts)
   ============================================ */
/* Backgrounds: Make subtle backgrounds dark and transparent */
[data-theme="dark"] .bg-primary-subtle {
    background-color: rgba(13, 110, 253, 0.15) !important;
}

[data-theme="dark"] .bg-secondary-subtle {
    background-color: rgba(108, 117, 125, 0.15) !important;
}

[data-theme="dark"] .bg-success-subtle {
    background-color: rgba(25, 135, 84, 0.15) !important;
}

[data-theme="dark"] .bg-info-subtle {
    background-color: rgba(13, 202, 240, 0.15) !important;
}

[data-theme="dark"] .bg-warning-subtle {
    background-color: rgba(255, 193, 7, 0.15) !important;
}

[data-theme="dark"] .bg-danger-subtle {
    background-color: rgba(220, 53, 69, 0.15) !important;
}

[data-theme="dark"] .bg-light-subtle {
    background-color: rgba(248, 249, 250, 0.15) !important;
}

[data-theme="dark"] .bg-dark-subtle {
    background-color: rgba(33, 37, 41, 0.3) !important;
}

/* Text Colors: Enforce visibility and brand colors with !important to override .table * */
[data-theme="dark"] .text-primary {
    color: #6ea8fe !important;
}

/* Blue-300 */
[data-theme="dark"] .text-secondary {
    color: #a0aec0 !important;
}

[data-theme="dark"] .text-success {
    color: #75b798 !important;
}

/* Green-300 */
[data-theme="dark"] .text-info {
    color: #6edff6 !important;
}

/* Cyan-300 */
[data-theme="dark"] .text-warning {
    color: #ffda6a !important;
}

/* Yellow-300 */
[data-theme="dark"] .text-danger {
    color: #ea868f !important;
}

/* Red-300 */
[data-theme="dark"] .text-light {
    color: #f8f9fa !important;
}

[data-theme="dark"] .text-dark {
    color: #e2e8f0 !important;
}

/* Light gray */
[data-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

/* Slate-400 */

/* ============================================
   Phase 9: Button Polish (.btn-light)
   ============================================ */
[data-theme="dark"] .btn-light {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .btn-light:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* ============================================
   Phase 10: Calendar Sniping
   ============================================ */
[data-theme="dark"] .calendar-event.pending {
    background-color: rgba(255, 193, 7, 0.15);
    color: #ffda6a;
    /* Text Warning */
}

[data-theme="dark"] .calendar-event.approved {
    background-color: rgba(25, 135, 84, 0.15);
    color: #75b798;
    /* Text Success */
}

[data-theme="dark"] .calendar-event.denied {
    background-color: rgba(220, 53, 69, 0.15);
    color: #ea868f;
    /* Text Danger */
}

/* ============================================
   Phase 11: Dropdown Polish
   ============================================ */
[data-theme="dark"] .dropdown-menu {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-divider {
    border-top-color: var(--border-color);
}

[data-theme="dark"] .dropdown-header {
    color: var(--text-muted);
}

/* ============================================
   Phase 12: Superuser Badge Sniping
   ============================================ */
/* Fix "Superuser Access" badge (White text on Yellow bg issue) */
/* Revert text-dark to black ONLY when on a warning background */
[data-theme="dark"] .badge.bg-warning.text-dark {
    color: #1a202c !important;
    /* Dark Slate 900 */
    background-color: #ffc107 !important;
    /* Bootstrap Warning Yellow */
    font-weight: 800 !important;
    /* Thicker as requested */
}

/* ============================================
   Weather Forecast Badges (Calendar Integration)
   ============================================ */
.weather-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    margin-top: 0.25rem;
    white-space: nowrap;
}

.weather-badge svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.weather-temp {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.6875rem;
}

/* Historical/Farmers' Almanac style data (dates beyond 16-day forecast) */
.weather-historical {
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    opacity: 0.85;
}

.weather-historical .weather-temp {
    font-style: italic;
}

/* Weather condition colors */
.weather-sunny {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

.weather-cloudy {
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    color: #4b5563;
}

.weather-rainy {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
}

.weather-snowy {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    color: #0369a1;
}

.weather-stormy {
    background: linear-gradient(135deg, #fecaca, #fca5a5);
    color: #991b1b;
}

/* Dark mode adjustments */
[data-theme="dark"] .weather-badge {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

[data-theme="dark"] .weather-temp {
    color: var(--text-secondary);
}

[data-theme="dark"] .weather-historical {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .weather-sunny {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
    color: #fcd34d;
}

[data-theme="dark"] .weather-cloudy {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.2), rgba(75, 85, 99, 0.2));
    color: #9ca3af;
}

[data-theme="dark"] .weather-rainy {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.2));
    color: #93c5fd;
}

[data-theme="dark"] .weather-snowy {
    background: linear-gradient(135deg, rgba(186, 230, 253, 0.2), rgba(125, 211, 252, 0.2));
    color: #bae6fd;
}

[data-theme="dark"] .weather-stormy {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2));
    color: #fca5a5;
}

/* Calendar cell weather styling */
.calendar-day .weather-badge {
    display: block;
    margin-top: 0.375rem;
    text-align: center;
}

/* Responsive: hide weather on very small calendar cells */
@media (max-width: 768px) {
    .calendar-day .weather-badge {
        display: none;
    }
}

/* ============================================
   Hero Section 7-Day Forecast Widget
   ============================================ */
.hero-forecast-widget {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* Current Weather Header */
.forecast-current-header {
    padding-bottom: 0.875rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.current-weather-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(147, 197, 253, 0.15));
}

.current-weather-icon svg {
    color: #3b82f6;
}

.current-weather-icon.sunny {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(253, 224, 71, 0.2));
}

.current-weather-icon.sunny svg {
    color: #f59e0b;
}

.current-temp {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
}

.forecast-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.forecast-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0.25rem;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    background: transparent;
}

.forecast-day:hover {
    background: rgba(var(--bs-primary-rgb), 0.08);
    transform: translateY(-2px);
}

.forecast-day.today {
    background: rgba(var(--bs-primary-rgb), 0.12);
    border: 1px solid rgba(var(--bs-primary-rgb), 0.2);
}

.forecast-day-name {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

.forecast-day.today .forecast-day-name {
    color: var(--bs-primary);
}

.forecast-day-icon {
    margin-bottom: 0.375rem;
}

.forecast-day-icon svg {
    width: 22px;
    height: 22px;
}

.forecast-day-temps {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
}

.forecast-temp-high {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.forecast-temp-low {
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Weather icon colors in forecast */
.forecast-day-icon .weather-icon-sun { color: #f59e0b; }
.forecast-day-icon .weather-icon-cloud-sun { color: #fbbf24; }
.forecast-day-icon .weather-icon-cloud { color: #6b7280; }
.forecast-day-icon .weather-icon-cloud-rain { color: #3b82f6; }
.forecast-day-icon .weather-icon-cloud-drizzle { color: #60a5fa; }
.forecast-day-icon .weather-icon-cloud-snow { color: #06b6d4; }
.forecast-day-icon .weather-icon-cloud-lightning { color: #8b5cf6; }
.forecast-day-icon .weather-icon-cloud-fog { color: #9ca3af; }

/* Hero Decorative Fallback (when weather not configured) */
.hero-decorative {
    position: relative;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.decorative-circles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.decorative-circles .circle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg,
        rgba(var(--bs-primary-rgb), 0.08),
        rgba(var(--bs-primary-rgb), 0.02));
    animation: float 6s ease-in-out infinite;
}

.decorative-circles .circle-1 {
    width: 120px;
    height: 120px;
    top: 20%;
    right: 10%;
    animation-delay: 0s;
}

.decorative-circles .circle-2 {
    width: 80px;
    height: 80px;
    top: 50%;
    right: 35%;
    animation-delay: -2s;
}

.decorative-circles .circle-3 {
    width: 60px;
    height: 60px;
    top: 15%;
    right: 45%;
    animation-delay: -4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.02); }
}

.decorative-icon {
    position: relative;
    z-index: 1;
    color: var(--bs-primary);
}

/* Dark Mode for Hero Forecast */
[data-theme="dark"] .hero-forecast-widget {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .forecast-current-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .current-weather-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
}

[data-theme="dark"] .current-weather-icon svg {
    color: #a5b4fc;
}

[data-theme="dark"] .current-weather-icon.sunny {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(253, 224, 71, 0.15));
}

[data-theme="dark"] .current-weather-icon.sunny svg {
    color: #fcd34d;
}

[data-theme="dark"] .forecast-day:hover {
    background: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .forecast-day.today {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] .decorative-circles .circle {
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.12),
        rgba(99, 102, 241, 0.04));
}

/* ============================================
   Navbar Scroll Effects (Global)
   ============================================ */
.nav-transparent {
    background: transparent !important;
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.nav-scrolled {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(10px);
    padding: 0.75rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .nav-scrolled {
    background: rgba(15, 23, 42, 0.9) !important;
}