/* HLC Authentication Service - Professional Design System 2025 */
/* 8px Grid System - Homogeneous Spacing */

/* OPACITY FIX - Force 100% visibility on text elements */
.ae-auth-form-container,
.ae-auth-form,
.ae-form-section,
.ae-section-title,
.ae-label,
.ae-upload-text,
.ae-field-description,
.ae-form-field,
.ae-form-row {
    opacity: 1 !important;
}

/* Container - 32px = 8px × 4 */
.ae-auth-form-container {
    margin: 32px 0;
    clear: both;
}

.ae-auth-form {
    max-width: 100%;
    background-color: transparent;
}

/* Section - 40px = 8px × 5 bottom margin, 32px = 8px × 4 padding */
.ae-form-section {
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid #e5e7eb;
}

.ae-form-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Section Title - 24px = 8px × 3 bottom margin */
.ae-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 24px 0;
    line-height: 1.4;
}

/* Form Row - 24px = 8px × 3 gap and margin */
.ae-form-row {
    display: grid;
    gap: 24px;
    margin-bottom: 24px;
}

.ae-form-row-2 {
    grid-template-columns: repeat(2, 1fr);
}

/* FIX: Add extra spacing between "Date Code" and "Notes" fields */
.ae-form-field:has(#ae_date_code) {
    margin-bottom: 24px;
}

/* Form Field - 16px = 8px × 2 gap */
.ae-form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

/* Label - 8px = 8px × 1 gap */
.ae-label {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ae-required {
    color: #dc2626;
    font-weight: 600;
    margin-left: 2px;
}

/* Inputs - Inherit theme styles */
.ae-input,
.ae-select,
.ae-textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    line-height: 1.5;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    transition: all 0.2s;
    font-family: inherit;
    background-color: transparent;
    box-sizing: border-box;
}

.ae-input:focus,
.ae-select:focus,
.ae-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    border-width: 2px;
    padding: 11px 15px;
}

.ae-input:hover,
.ae-select:hover,
.ae-textarea:hover {
    border-color: #9ca3af;
}

.ae-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
    padding-right: 44px;
}

.ae-textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

/* Field Description - 8px = 8px × 1 bottom margin */
.ae-field-description {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #6b7280;
    margin: 0 0 8px 0;
}

/* Error Messages - 16px = 8px × 2 bottom margin */
.ae-error {
    font-size: 0.875rem;
    line-height: 1.4;
    color: #dc2626;
    min-height: 20px;
    display: none;
    margin-top: 4px;
    margin-bottom: 16px;
}

.ae-form-field.ae-has-error .ae-input,
.ae-form-field.ae-has-error .ae-select,
.ae-form-field.ae-has-error .ae-textarea {
    border-color: #dc2626;
    background-color: rgba(220, 38, 38, 0.05);
}

.ae-form-field.ae-has-error .ae-error {
    display: block;
}

/* Upload Zone - 48px = 8px × 6 padding */
.ae-upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
    background-color: transparent;
}

.ae-upload-zone:hover {
    border-color: #9ca3af;
    transform: translateY(-2px);
}

.ae-upload-zone.dragging {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.05);
    transform: scale(0.99);
}

.ae-upload-content {
    pointer-events: none;
}

.ae-upload-icon {
    margin: 0 auto 20px;
    color: #6b7280;
}

.ae-upload-text {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    margin: 0 0 8px 0;
    color: #111827;
}

.ae-upload-hint {
    font-size: 0.875rem;
    line-height: 1.4;
    color: #6b7280;
    margin: 0;
}

.ae-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

/* Files Preview - 16px = 8px × 2 margin */
.ae-files-preview {
    margin-top: 16px;
}

.ae-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

/* File Preview with Loading States */
.ae-file-preview {
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    background-color: #fff;
    transition: all 0.2s;
}

.ae-file-preview:hover {
    border-color: #d1d5db;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ae-file-preview.uploading {
    opacity: 0.6;
}

.ae-file-preview.uploading .ae-file-preview-content {
    filter: blur(1px);
}

.ae-file-preview img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 12px;
    display: block;
}

.ae-file-icon {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    color: #9ca3af;
    margin-bottom: 12px;
    background-color: #f9fafb;
    border-radius: 6px;
}

.ae-file-name {
    font-size: 0.875rem;
    line-height: 1.4;
    word-break: break-word;
    margin-bottom: 6px;
    color: #374151;
}

.ae-file-size {
    font-size: 0.75rem;
    line-height: 1.3;
    color: #6b7280;
    margin-bottom: 12px;
}

.ae-file-remove {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid #dc2626;
    color: #dc2626;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.ae-file-remove:hover {
    background: #dc2626;
    color: #fff;
    transform: translateY(-1px);
}

/* Loading/Success Status Badge */
.ae-file-status {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
}

.ae-file-uploading {
    background: #fef3c7;
    color: #92400e;
}

.ae-file-uploaded {
    background: #d1fae5;
    color: #065f46;
}

.ae-loading-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid #92400e;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Form Actions - 40px = 8px × 5 top margin, 16px = 8px × 2 gap */
.ae-form-actions {
    margin-top: 40px;
    display: flex;
    gap: 16px;
    justify-content: flex-start;
}

/* Buttons - Inherit theme/Elementor styles */
.ae-save-form-btn {
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    border: 2px solid currentColor;
    color: inherit;
    background-color: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.ae-save-form-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ae-save-form-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Summary - 32px = 8px × 4 padding */
.ae-form-summary {
    display: none;
    padding: 32px;
    background: #d1fae5;
    border: 2px solid #059669;
    border-radius: 12px;
    margin: 32px 0;
}

.ae-form-summary.active {
    display: block;
}

.ae-summary-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.ae-summary-icon {
    width: 48px;
    height: 48px;
    background: #10b981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ae-summary-icon svg {
    width: 28px;
    height: 28px;
    stroke: #fff;
    stroke-width: 3;
}

.ae-summary-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #065f46;
    line-height: 1.4;
    margin: 0;
}

.ae-summary-content {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.ae-summary-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.ae-summary-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.ae-summary-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 12px 0;
}

.ae-summary-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.ae-summary-row:last-child {
    margin-bottom: 0;
}

.ae-summary-label {
    font-weight: 500;
    color: #374151;
}

.ae-summary-value {
    color: #1f2937;
    text-align: right;
}

.ae-summary-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.ae-summary-file-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 0.8125rem;
    color: #374151;
}

.ae-summary-actions {
    display: flex;
    gap: 12px;
}

.ae-edit-form-btn {
    padding: 12px 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    border: 2px solid #059669;
    color: #059669;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.ae-edit-form-btn:hover {
    background: #059669;
    color: #fff;
    transform: translateY(-1px);
}

/* Form Notice - 32px = 8px × 4 top margin, 16px = 8px × 2 gap */
.ae-form-notice {
    margin-top: 32px;
    padding: 16px 20px;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    font-size: 0.9375rem;
    line-height: 1.5;
    border: 1px solid #e5e7eb;
    background-color: #f9fafb;
    color: #374151;
}

.ae-form-notice svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: #6b7280;
}

/* Responsive - Maintain 8px grid */
@media (max-width: 768px) {
    .ae-form-row-2 {
        grid-template-columns: 1fr;
    }
    
    .ae-form-section {
        margin-bottom: 32px;
        padding-bottom: 24px;
    }
    
    .ae-section-title {
        font-size: 1.125rem;
        margin-bottom: 16px;
    }
    
    .ae-upload-zone {
        padding: 40px 20px;
    }
    
    .ae-files-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .ae-file-preview {
        padding: 10px;
    }
    
    .ae-file-preview img,
    .ae-file-icon {
        height: 100px;
    }
    
    .ae-input,
    .ae-select,
    .ae-textarea {
        font-size: 16px;
        padding: 14px 16px;
    }
    
    .ae-input:focus,
    .ae-select:focus,
    .ae-textarea:focus {
        padding: 13px 15px;
    }
    
    .ae-form-notice {
        padding: 16px;
        gap: 12px;
        font-size: 0.875rem;
    }
    
    .ae-form-actions {
        flex-direction: column;
    }
    
    .ae-save-form-btn {
        width: 100%;
    }
    
    .ae-summary-header {
        flex-direction: column;
        text-align: center;
    }
    
    .ae-summary-row {
        flex-direction: column;
        gap: 4px;
    }
    
    .ae-summary-value {
        text-align: left;
    }
    
    .ae-summary-actions {
        flex-direction: column;
    }
    
    .ae-edit-form-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .ae-files-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Override WooCommerce Add to Cart Button */
form.cart button.single_add_to_cart_button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(50%);
}
