/* ============================================
   Forms
   ============================================ */

form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 600px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input, textarea, select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: all var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

input::placeholder, textarea::placeholder {
    color: var(--text-tertiary);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.inline-form {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    max-width: none;
    width: 100%;
}

.inline-form label {
    min-width: 160px;
    flex: 1 1 160px;
}

.inline-form label:first-child {
    flex: 2 1 220px;
}

.checkbox-inline {
    flex-direction: row;
    align-items: center;
    cursor: pointer;
}

.checkbox-inline input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ============================================
   Actions Bar & Filters
   ============================================ */

.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.actions-bar form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    max-width: none;
    flex-direction: row;
}

.filter-bar {
    background: var(--bg-tertiary);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.filter-bar form {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: none;
    flex-direction: row;
}

.filter-bar label {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
}

.filter-bar select {
    min-width: 200px;
}


/* ============================================
   Form Utilities
   ============================================ */

.form-hint {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.code-tag {
    font-size: 0.85rem;
    background: var(--gray-100);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.bg-disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.form-actions-spread {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: space-between;
}

.form-wrapper {
    max-width: 700px;
    margin: 0 auto;
}


/* ============================================
   Form Field Validation Errors
   ============================================ */

.field-error {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.82rem;
    color: var(--danger-600);
    font-weight: 500;
}

.input-error {
    border-color: var(--danger-500) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

/* Upload zone keyboard focus */
.upload-zone:focus,
.upload-zone:focus-visible {
    outline: 3px solid var(--primary-500);
    outline-offset: 3px;
}


/* ============================================
   File Upload / Drag & Drop
   ============================================ */

.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
    background: var(--bg-tertiary);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary-500);
    background: var(--primary-50);
}

.upload-zone.dragover {
    transform: scale(1.02);
}

.upload-zone-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-zone-text {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.upload-zone-hint {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}


/* ============================================
   Collapsible Filter Bar
   ============================================ */

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.75rem 1.25rem;
    border: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    font-family: inherit;
    width: 100%;
    text-align: left;
    margin-bottom: 0;
    transition: all var(--transition-fast);
}

.filter-toggle:hover {
    background: var(--gray-200);
}

.filter-toggle .chevron-icon {
    margin-left: auto;
    transition: transform var(--transition-fast);
}

.filter-toggle[aria-expanded="true"] .chevron-icon {
    transform: rotate(180deg);
}

.filter-toggle[aria-expanded="true"] {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.filter-body {
    max-height: 300px;
    overflow: hidden;
    transition: max-height var(--transition-normal) ease-in-out, padding var(--transition-normal);
    background: var(--bg-tertiary);
    padding: 0 1.25rem 1.25rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.filter-body.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}


/* ============================================
   Login Page
   ============================================ */

.login-wrapper {
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
}

.login-wrapper h2 {
    justify-content: center;
}

.login-wrapper h2::after {
    display: none;
}

.login-form {
    max-width: 100%;
    margin-top: 2rem;
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
}

.login-form button {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    margin-top: 0.5rem;
}


/* ============================================
   Login Page (Full-screen, no sidebar)
   ============================================ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(-45deg, #312e81, #111827, #3730a3, #1a103d);
    background-size: 400% 400%;
    animation: loginGradient 12s ease infinite;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
    max-width: 100%;
}

@keyframes loginGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.login-card {
    background: #ffffff;
    border: none;
    border-radius: var(--radius-xl);
    padding: 3rem 2.5rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.login-card h2 {
    color: #111827;
    justify-content: center;
}

.login-card h2::after {
    display: none;
}

.login-card .subtitle {
    color: #4b5563;
}

.login-card .icon {
    color: #4f46e5;
}

.login-card label {
    color: #374151;
}

.login-card input {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid #d1d5db;
    color: #111827;
}

.login-card input::placeholder {
    color: #9ca3af;
}

.login-card input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.login-card .alert.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #f87171;
    color: #dc2626;
}

.login-card p {
    color: #6b7280;
}

