/* static/css/base.css */
[x-cloak] {
    display: none !important;
}

/* Smooth transitions for dark mode */
html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #3b82f6;
    color: white;
    padding: 8px;
    z-index: 100;
    border-radius: 4px;
}

.skip-link:focus {
    top: 0;
}

/* Accessibility enhancements */
a, button {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

select, input, textarea {
    font-size: 16px !important;
}

@media (max-width: 639px) {
    /* Fix horizontal scroll */
    html, body {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Content padding */
    main {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        overflow-x: hidden;
    }
    
    /* Mobile form input sizing */
    input, select, textarea {
        min-height: 44px;
    }
}

/* ============================================= */
/* CRITICAL DARK MODE FIXES FOR FORM VISIBILITY */
/* ============================================= */

/* Global form elements */
input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    outline: none;
    background-color: #ffffff;
    color: #1f2937;
    transition: all 0.2s ease;
}

/* FIXED: Use html.dark selector for proper specificity */
html.dark input:not([type="checkbox"]):not([type="radio"]),
html.dark textarea,
html.dark select {
    background-color: #374151 !important;
    color: #f3f4f6 !important;
    border-color: #4b5563 !important;
}

input:focus, textarea:focus, select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

html.dark input:focus, 
html.dark textarea:focus, 
html.dark select:focus {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.5);
}

/* Labels and field names - FIXED HEADER VISIBILITY */
.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #374151;
}

html.dark .form-label {
    color: #e5e7eb !important;
}

/* Form headers - FIXED VISIBILITY */
.form-header {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #1f2937;
}

html.dark .form-header {
    color: #f3f4f6 !important;
}

/* Tables - critical fixes */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    padding: 0.75rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: #f9fafb;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

html.dark th {
    background-color: #111827 !important;
    color: #e5e7eb !important;
    border-bottom-color: #374151 !important;
}

td {
    padding: 1rem 1.5rem;
    white-space: nowrap;
    font-size: 0.875rem;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

html.dark td {
    color: #e5e7eb !important;
    background-color: #1f2937 !important;
    border-bottom-color: #374151 !important;
}

tr:last-child td {
    border-bottom: none;
}

/* Buttons */
.btn-primary {
    background-color: #2563eb;
    color: white;
    padding: 0.75rem 0;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
    font-weight: 500;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    outline: none;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

html.dark .btn-primary {
    background-color: #3b82f6;
}

html.dark .btn-primary:hover {
    background-color: #1d4ed8;
}

/* Sidebar improvements */
.sidebar-item {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s, color 0.2s;
    color: #374151;
}

html.dark .sidebar-item {
    color: #d1d5db;
}

.sidebar-item:hover {
    background-color: #f3f4f6;
}

html.dark .sidebar-item:hover {
    background-color: #4b5563;
}

.sidebar-item.active {
    background-color: #e5e7eb;
}

html.dark .sidebar-item.active {
    background-color: #374151;
    color: #ffffff;
}

/* Main content area */
.main-content {
    background-color: #f9fafb;
}

html.dark .main-content {
    background-color: #111827;
}

/* Card styling */
.card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
}

html.dark .card {
    background-color: #1f2937;
}

/* Message styling */
.message {
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.message-success {
    background-color: #dcfce7;
    color: #166534;
}

html.dark .message-success {
    background-color: #14532d;
    color: #bbf7d0;
}

.message-error {
    background-color: #fee2e2;
    color: #b91c1c;
}

html.dark .message-error {
    background-color: #7f1d1d;
    color: #fecaca;
}

.message-warning {
    background-color: #fef3c7;
    color: #b45309;
}

html.dark .message-warning {
    background-color: #78350f;
    color: #fde68a;
}

/* Force text color in dark mode */
html.dark {
    color: #e5e7eb !important;
}

/* Exception for light text elements */
html.dark .text-gray-500 {
    color: #9ca3af !important;
}

/* Dark mode toggle styles */
.dark-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.dark-toggle:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.dark-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

.dark-toggle svg {
    width: 20px;
    height: 20px;
    transition: all 0.3s ease;
}

.dark-toggle .light-icon {
    color: #4b5563;
}

.dark-toggle .dark-icon {
    color: #fbbf24;
}

/* Session timeout modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

html.dark .modal-content {
    background-color: #1f2937;
}


