/* AI-Header: Reusable form component styles */
/* Date: 2025-07-13 */

/* ===========================================
   FORMS - BASE STRUCTURE
   =========================================== */

/* Form Base Styles */
.form-container {
    max-width: 500px;
    margin: 0 auto;
}

.form-section {
    margin-bottom: 2rem;
}

.form-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: inherit;
}

/* Input Group Styles */
.input-group {
    margin-bottom: 1rem;
    position: relative;
}

.input-group-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: inherit;
}

.input-group-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 1px solid;
    font-size: 1rem;
    transition: all 0.2s ease;
    outline: none;
    background: inherit;
    color: inherit;
}

.input-group-input:focus {
    transform: translateY(-1px);
    box-shadow: 0 0 0 2px rgba(114, 47, 55, 0.2);
}

.input-group-error {
    color: #dc3545;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: block;
}

/* Button Group Styles */
.button-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.button-group-full {
    flex-direction: column;
}

.button-group-inline {
    flex-direction: row;
    flex-wrap: wrap;
}

/* Form Actions */
.form-actions {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid;
    text-align: center;
}

.form-actions-left {
    text-align: left;
}

.form-actions-right {
    text-align: right;
}

/* Validation Styles */
.validation-summary {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.validation-summary ul {
    margin: 0;
    padding-left: 1.5rem;
}

.validation-summary li {
    font-size: 0.875rem;
}

/* Loading States */
.form-loading {
    opacity: 0.6;
    pointer-events: none;
}

.form-loading .input-group-input {
    background: #f8f9fa;
    cursor: not-allowed;
}

/* Checkbox and Radio Styles */
.checkbox-group,
.radio-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.checkbox-input,
.radio-input {
    width: auto;
    margin: 0;
}

.checkbox-label,
.radio-label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
}

/* Select Styles */
.select-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 1px solid;
    font-size: 1rem;
    background: inherit;
    color: inherit;
    cursor: pointer;
}

/* Textarea Styles */
.textarea-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 1px solid;
    font-size: 1rem;
    background: inherit;
    color: inherit;
    resize: vertical;
    min-height: 100px;
}

/* File Input Styles */
.file-input-group {
    margin-bottom: 1rem;
}

.file-input {
    width: 100%;
    padding: 0.5rem;
    border: 2px dashed;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-input:hover {
    border-style: solid;
}

/* Form Grid Layout */
.form-grid {
    display: grid;
    gap: 1rem;
}

.form-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.form-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-grid-span-2 {
    grid-column: span 2;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .form-container {
        padding: 0 1rem;
    }
    
    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }
    
    .button-group-inline {
        flex-direction: column;
    }
    
    .button-group .theme-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Focus Management */
.input-group-input:invalid {
    border-color: #dc3545;
}

.input-group-input:valid {
    border-color: #198754;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Form Step Indicator */
.form-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 0;
    list-style: none;
}

.form-step {
    flex: 1;
    text-align: center;
    position: relative;
}

.form-step::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -50%;
    width: 100%;
    height: 2px;
    background: #dee2e6;
    z-index: -1;
}

.form-step:last-child::after {
    display: none;
}

.form-step.active {
    color: #722F37;
    font-weight: 600;
}

.form-step.completed::after {
    background: #198754;
}

/* ===========================================
   FORMS - THEME ENHANCEMENTS
   =========================================== */

/* Light Theme Forms */
[data-bs-theme="light"] .form-control {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    color: #495057;
    border-radius: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="light"] .form-control:focus {
    background-color: #ffffff;
    border-color: #722F37;
    color: #495057;
    box-shadow: 0 0 0 0.2rem rgba(114, 47, 55, 0.15);
}

[data-bs-theme="light"] .form-control::placeholder {
    color: #9ca3af;
}

[data-bs-theme="light"] .form-label {
    color: #495057;
    font-weight: 500;
}

[data-bs-theme="light"] h1, 
[data-bs-theme="light"] h2, 
[data-bs-theme="light"] h3, 
[data-bs-theme="light"] h4, 
[data-bs-theme="light"] h5, 
[data-bs-theme="light"] h6 {
    color: #212529;
}

/* Dark Theme Forms */
[data-bs-theme="dark"] .form-control {
    background-color: #3d3d3d;
    border: 1px solid #555555;
    color: #ffffff;
    border-radius: 8px;
    transition: all 0.2s ease;
}

[data-bs-theme="dark"] .form-control:focus {
    background-color: #404040;
    border-color: #666666;
    color: #ffffff;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: #9ca3af;
}

[data-bs-theme="dark"] .form-label {
    color: #ffffff;
    font-weight: 500;
}

[data-bs-theme="dark"] h1, 
[data-bs-theme="dark"] h2, 
[data-bs-theme="dark"] h3, 
[data-bs-theme="dark"] h4, 
[data-bs-theme="dark"] h5, 
[data-bs-theme="dark"] h6 {
    color: #ffffff;
}

/* ===========================================
   FORMS - DARK BURGUNDY THEME (UNAUTHENTICATED)
   =========================================== */

/* Form groups for unauthenticated pages */
.form-group {
    margin-bottom: 1.5rem;
}

/* Form labels for unauthenticated pages */
.form-label {
    display: block;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Form inputs for unauthenticated pages */
.form-input, 
input.form-input, 
.form-input input {
    width: 100%;
    background: #2d0000 !important;
    border: 1px solid #5a0000 !important;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    color: #ffffff !important;
    font-size: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

.form-input::placeholder, 
input.form-input::placeholder, 
.form-input input::placeholder {
    color: #cc9999 !important;
    opacity: 0.8;
}

.form-input:focus, 
input.form-input:focus, 
.form-input input:focus {
    background: #3d0000 !important;
    border-color: #cc5500 !important;
    box-shadow: 0 0 0 2px rgba(204, 85, 0, 0.2);
    color: #ffffff !important;
    transform: translateY(-1px);
}

.form-input:not(:placeholder-shown), 
input.form-input:not(:placeholder-shown), 
.form-input input:not(:placeholder-shown) {
    color: #ffffff !important;
    background: #2d0000 !important;
    border-color: #6d0000 !important;
}

.form-input:focus:not(:placeholder-shown), 
input.form-input:focus:not(:placeholder-shown), 
.form-input input:focus:not(:placeholder-shown) {
    background: #3d0000 !important;
    border-color: #cc5500 !important;
    color: #ffffff !important;
}

/* Browser autofill override for unauthenticated pages */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus,
input.form-input:-webkit-autofill,
input.form-input:-webkit-autofill:hover,
input.form-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #2d0000 inset !important;
    -webkit-text-fill-color: #ffffff !important;
    background-color: #2d0000 !important;
    border-color: #5a0000 !important;
}

/* Specific input types for unauthenticated pages */
input[type="email"].form-input,
input[type="text"].form-input,
input[type="password"].form-input {
    background: #2d0000 !important;
    color: #ffffff !important;
    border: 1px solid #5a0000 !important;
}

/* Disabled form inputs for unauthenticated pages */
.form-input.disabled {
    background: #1a0000;
    color: #666666;
    cursor: not-allowed;
}

/* Field error for unauthenticated pages */
.field-error {
    color: #fca5a5;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: block;
}

/* Copyright footer for auth pages */
.auth-copyright {
    font-size: 0.75rem;
    color: #888;
    text-align: center;
    margin: 8px 0 0 0;
}

/* Utility classes for inline content */
.break-word {
    word-break: break-all;
}

.monospace {
    font-family: monospace;
}

.fullheight-center {
    height: 100vh;
}

/* ===========================================
   ESHOP-STYLE FORM ENHANCEMENTS (Phase 1)
   =========================================== */

/* Enhanced validation messages with eShop patterns */
.validation-message-enhanced {
    color: var(--bs-danger);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
}

.validation-message-enhanced::before {
    content: "⚠";
    font-size: 0.75rem;
    flex-shrink: 0;
}

.validation-success {
    color: var(--bs-success);
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.validation-success::before {
    content: "✓";
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Production-friendly validation success (no visible text/icons - Phase 4 refinement) */
.validation-success-silent {
    /* Invisible but maintains layout space and accessibility */
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* Screen reader accessible but visually hidden */
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    border: 0;
    padding: 0;
    white-space: nowrap;
    clip-path: inset(100%);
    clip: rect(0 0 0 0);
}

/* eShop-style form field states (extending existing .form-control styles) */
.form-control.is-valid-enhanced {
    /* Production-friendly: Subtle green border without strong shadow (Phase 4 refinement) */
    border-color: rgba(var(--bs-success-rgb), 0.6);
    box-shadow: 0 0 0 0.075rem rgba(var(--bs-success-rgb), 0.15);
    background-image: none; /* Remove bootstrap's built-in checkmark */
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control.is-invalid-enhanced {
    border-color: var(--bs-danger);
    box-shadow: 0 0 0 0.125rem rgba(var(--bs-danger-rgb), 0.25);
    background-image: none; /* Remove bootstrap's built-in X mark */
}

.form-control.field-interacted {
    border-color: var(--bs-primary);
    transition: all 0.2s ease;
}

.form-control.field-interacted:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.125rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Enhanced save button styling (eShop pattern) extending existing button styles */
.save-button-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.save-status-indicator {
    font-size: 0.875rem;
    color: var(--bs-success);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
}

.save-status-indicator.saving {
    color: var(--bs-primary);
}

.save-status-indicator.error {
    color: var(--bs-danger);
}

/* Profile form specific enhancements */
.profile-form-field {
    position: relative;
    margin-bottom: 1rem;
}

.profile-form-field .form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: inherit;
}

.profile-form-field-indicator {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 10;
}

/* Real-time validation feedback */
.validation-feedback-realtime {
    min-height: 1.25rem; /* Reserve space to prevent layout shift */
    margin-top: 0.25rem;
}

.validation-feedback-realtime.empty {
    visibility: hidden;
}

/* Theme-specific enhancements for existing CSS infrastructure */
[data-bs-theme="light"] .validation-message-enhanced {
    color: #dc3545;
}

[data-bs-theme="light"] .validation-success {
    color: #198754;
}

[data-bs-theme="dark"] .validation-message-enhanced {
    color: #ea868f;
}

[data-bs-theme="dark"] .validation-success {
    color: #75b798;
}

/* Mobile responsiveness for enhanced validation */
@media (max-width: 768px) {
    .validation-message-enhanced,
    .validation-success {
        font-size: 0.8rem;
    }
    
    .save-button-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .save-status-indicator {
        text-align: center;
    }
}

/* ===========================================
   SEARCH INPUT - THEME-AWARE STYLING
   =========================================== */

/* Search input icon background - theme-aware */
[data-bs-theme="light"] {
    --search-icon-bg: #722F37;
}

[data-bs-theme="dark"] {
    --search-icon-bg: #3D3D3D;
}

.search-input-icon {
    background-color: var(--search-icon-bg) !important;
    border-color: var(--search-icon-bg) !important;
}

/* ===========================================
   CONTACT FORMS - SECTION STYLING
   =========================================== */

/* Contact form sections - following app-wide patterns */
.contact-form-section {
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid;
    overflow: hidden;
    transition: all 0.2s ease;
}

.contact-form-section-body {
    padding: 1.5rem;
}

.contact-form-section h5 {
    margin-bottom: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contact-form-section h5 i {
    font-size: 1.25rem;
}

/* Light theme contact form sections */
[data-bs-theme="light"] .contact-form-section {
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

[data-bs-theme="light"] .contact-form-section h5 {
    color: #495057;
}

[data-bs-theme="light"] .contact-form-section .form-control {
    background-color: #ffffff;
    border-color: #e9ecef;
    color: #495057;
}

[data-bs-theme="light"] .contact-form-section .form-control:focus {
    background-color: #ffffff;
    border-color: #722F37;
    color: #495057;
    box-shadow: 0 0 0 0.2rem rgba(114, 47, 55, 0.15);
}

/* Dark theme contact form sections */
[data-bs-theme="dark"] .contact-form-section {
    background-color: #2d2d2d;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .contact-form-section h5 {
    color: #ffffff;
}

[data-bs-theme="dark"] .contact-form-section .form-control {
    background-color: #3d3d3d;
    border-color: #555555;
    color: #ffffff;
}

[data-bs-theme="dark"] .contact-form-section .form-control:focus {
    background-color: #404040;
    border-color: #666666;
    color: #ffffff;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.1);
}


