/* ============================================
   GALARY EDGE - Form Styles
   Production-ready form styling
   ============================================ */

/* ============================================
   FORM VALIDATION STATES
   ============================================ */
.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--error-red);
    background-color: rgba(231, 76, 60, 0.05);
}

.form-input.success,
.form-select.success,
.form-textarea.success {
    border-color: var(--success-green);
    background-color: rgba(39, 174, 96, 0.05);
}

.form-error {
    display: none;
    color: var(--error-red);
    font-size: 13px;
    margin-top: 6px;
    animation: fadeInError 0.3s ease;
}

.form-error.active {
    display: block;
}

.form-success {
    display: none;
    color: var(--success-green);
    font-size: 13px;
    margin-top: 6px;
}

.form-success.active {
    display: block;
}

@keyframes fadeInError {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   FORM MESSAGES & ALERTS
   ============================================ */
.form-message {
    padding: 20px;
    border-radius: 8px;
    margin-bottom: var(--spacing-md);
    font-size: 14px;
    font-weight: 500;
    display: none;
    animation: slideDown 0.4s ease;
}

.form-message.active {
    display: block;
}

.form-message.success {
    background: rgba(39, 174, 96, 0.1);
    border: 2px solid var(--success-green);
    color: #27AE60;
}

.form-message.error {
    background: rgba(231, 76, 60, 0.1);
    border: 2px solid var(--error-red);
    color: var(--error-red);
}

.form-message.warning {
    background: rgba(243, 156, 18, 0.1);
    border: 2px solid #F39C12;
    color: #E67E22;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   LOADING STATES
   ============================================ */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   REQUIRED FIELD INDICATOR
   ============================================ */
.form-label.required::after {
    content: ' *';
    color: var(--error-red);
    font-weight: bold;
}

/* ============================================
   FIELD ICONS
   ============================================ */
.form-group.has-icon {
    position: relative;
}

.form-group.has-icon .form-input {
    padding-left: 45px;
}

.form-icon {
    position: absolute;
    left: 15px;
    top: 38px;
    color: var(--text-secondary);
    font-size: 18px;
    pointer-events: none;
}

.form-input:focus ~ .form-icon {
    color: var(--primary-gold);
}

/* ============================================
   CHECKBOX & RADIO CUSTOM STYLES
   ============================================ */
.checkbox-group,
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px;
    border: 2px solid var(--border-light);
    border-radius: 6px;
    transition: all var(--transition-normal);
}

.checkbox-label:hover,
.radio-label:hover {
    border-color: var(--primary-gold);
    background: rgba(201, 169, 97, 0.05);
}

.checkbox-label input[type="checkbox"],
.radio-label input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-gold);
    cursor: pointer;
}

/* ============================================
   FILE UPLOAD STYLING
   ============================================ */
.file-upload {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.file-upload input[type="file"] {
    position: absolute;
    left: -9999px;
}

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: var(--warm-white);
    border: 2px dashed var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
    flex-direction: column;
    gap: 12px;
}

.file-upload-label:hover {
    border-color: var(--primary-gold);
    background: rgba(201, 169, 97, 0.05);
}

.file-upload-icon {
    font-size: 48px;
    color: var(--text-secondary);
}

.file-list {
    margin-top: 12px;
    padding: 12px;
    background: var(--warm-white);
    border-radius: 6px;
    display: none;
}

.file-list.active {
    display: block;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: white;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 14px;
}

.file-item:last-child {
    margin-bottom: 0;
}

.file-remove {
    color: var(--error-red);
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    padding: 0 8px;
}

.file-remove:hover {
    color: #C0392B;
}

/* ============================================
   CHARACTER COUNTER
   ============================================ */
.char-counter {
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.char-counter.warning {
    color: #F39C12;
}

.char-counter.error {
    color: var(--error-red);
}

/* ============================================
   FORM PROGRESS INDICATOR (for multi-step forms)
   ============================================ */
.form-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
    position: relative;
}

.form-progress::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-light);
    z-index: 0;
}

.progress-line {
    position: absolute;
    top: 20px;
    left: 0;
    height: 2px;
    background: var(--primary-gold);
    z-index: 1;
    transition: width 0.4s ease;
}

.progress-step {
    position: relative;
    z-index: 2;
    text-align: center;
    flex: 1;
}

.progress-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-weight: 600;
    transition: all var(--transition-normal);
}

.progress-step.active .progress-circle {
    background: var(--primary-gold);
    border-color: var(--primary-gold);
    color: white;
}

.progress-step.completed .progress-circle {
    background: var(--success-green);
    border-color: var(--success-green);
    color: white;
}

.progress-step.completed .progress-circle::before {
    content: '✓';
}

.progress-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-step.active .progress-label {
    color: var(--primary-gold);
    font-weight: 600;
}

/* ============================================
   HONEYPOT (Anti-spam)
   ============================================ */
.honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   FORM DISABLED STATE
   ============================================ */
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--soft-gray);
}

/* ============================================
   FLOATING LABELS (Optional Enhancement)
   ============================================ */
.form-group.floating-label {
    position: relative;
}

.form-group.floating-label .form-label {
    position: absolute;
    left: 16px;
    top: 18px;
    transition: all 0.2s ease;
    pointer-events: none;
    background: white;
    padding: 0 6px;
}

.form-group.floating-label .form-input:focus ~ .form-label,
.form-group.floating-label .form-input:not(:placeholder-shown) ~ .form-label {
    top: -10px;
    font-size: 12px;
    color: var(--primary-gold);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
    .form-message {
        padding: 16px;
        font-size: 13px;
    }
    
    .file-upload-label {
        padding: 30px 15px;
    }
    
    .form-progress {
        margin-bottom: var(--spacing-md);
    }
    
    .progress-label {
        font-size: 10px;
    }
    
    .progress-circle {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .btn,
    .file-upload,
    .form-message {
        display: none;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        border: 1px solid #000;
        background: white;
    }
}