/**
 * Standard Modal Styles
 * Matches the invoice modal aesthetics with consistent styling
 */

/* Modal Form Sections */
.modal-form-section {
    background-color: #f9fafb; /* gray-50 */
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb; /* gray-200 */
    margin-bottom: 1.5rem;
}

.modal-form-section:last-child {
    margin-bottom: 0;
}

.modal-form-section-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.875rem; /* 14px */
    font-weight: 500;
    color: #111827; /* gray-900 */
}

.modal-form-section-icon {
    height: 1.25rem; /* 20px */
    width: 1.25rem;
    margin-right: 0.5rem;
    color: #4f46e5; /* primary-500 */
}

/* Form Field Styling */
.modal-form-field {
    margin-bottom: 1rem;
}

.modal-form-field:last-child {
    margin-bottom: 0;
}

.modal-form-label {
    display: block;
    font-size: 0.875rem; /* 14px */
    font-weight: 500;
    color: #374151; /* gray-700 */
    margin-bottom: 0.25rem;
}

.modal-form-label-required::after {
    content: ' *';
    color: #dc2626; /* error-500 */
}

.modal-form-input,
.modal-form-select,
.modal-form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db; /* gray-300 */
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    font-size: 0.875rem; /* 14px */
    transition: all 0.2s ease-in-out;
}

.modal-form-input:focus,
.modal-form-select:focus,
.modal-form-textarea:focus {
    outline: none;
    border-color: #4f46e5; /* primary-500 */
    ring: 1px;
    ring-color: #4f46e5; /* primary-500 */
}

.modal-form-input:disabled,
.modal-form-select:disabled,
.modal-form-textarea:disabled {
    background-color: #f3f4f6; /* gray-100 */
    color: #9ca3af; /* gray-400 */
    cursor: not-allowed;
}

.modal-form-helper-text {
    margin-top: 0.25rem;
    font-size: 0.75rem; /* 12px */
    color: #6b7280; /* gray-500 */
}

.modal-form-error-text {
    margin-top: 0.25rem;
    font-size: 0.75rem; /* 12px */
    color: #dc2626; /* error-600 */
}

/* Input with Icon */
.modal-form-input-with-icon {
    position: relative;
}

.modal-form-input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    height: 1.25rem;
    width: 1.25rem;
    color: #9ca3af; /* gray-400 */
    pointer-events: none;
}

.modal-form-input-with-icon input,
.modal-form-input-with-icon select {
    padding-left: 2.5rem;
}

/* Currency Input */
.modal-form-currency-input {
    position: relative;
}

.modal-form-currency-symbol {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280; /* gray-500 */
    font-size: 0.875rem;
    pointer-events: none;
}

.modal-form-currency-input input {
    padding-left: 1.75rem;
}

/* Modal Grid Layout */
.modal-form-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .modal-form-grid-2 {
        grid-template-columns: 1fr 1fr;
    }
}

/* Modal Animation */
.modal-fade-in {
    animation: fadeIn 0.2s ease-in-out;
}

.modal-fade-out {
    animation: fadeOut 0.2s ease-in-out;
}

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

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

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 40;
}

/* Responsive Modal Sizing */
@media (max-width: 640px) {
    .modal-form-section {
        padding: 0.75rem;
    }
    
    .modal-form-grid-2 {
        gap: 1rem;
    }
}

/* Modal Loading State */
.modal-loading {
    pointer-events: none;
    opacity: 0.6;
}

.modal-loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Success/Error States */
.modal-form-input.error {
    border-color: #dc2626; /* error-600 */
}

.modal-form-input.error:focus {
    ring-color: #dc2626; /* error-600 */
}

.modal-form-input.success {
    border-color: #16a34a; /* success-600 */
}

.modal-form-input.success:focus {
    ring-color: #16a34a; /* success-600 */
}

/* Checkbox and Radio Styling */
.modal-form-checkbox,
.modal-form-radio {
    height: 1rem;
    width: 1rem;
    color: #4f46e5; /* primary-600 */
    border-color: #d1d5db; /* gray-300 */
    border-radius: 0.25rem;
}

.modal-form-checkbox:focus,
.modal-form-radio:focus {
    ring: 2px;
    ring-color: #4f46e5; /* primary-500 */
    ring-offset: 2px;
}

.modal-form-radio {
    border-radius: 50%;
}

/* File Input Styling */
.modal-form-file-input {
    display: block;
    width: 100%;
    font-size: 0.875rem;
    color: #6b7280; /* gray-500 */
    background-color: #ffffff;
    border: 1px solid #d1d5db; /* gray-300 */
    border-radius: 0.375rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
}

.modal-form-file-input:hover {
    border-color: #9ca3af; /* gray-400 */
}

.modal-form-file-input:focus {
    outline: none;
    border-color: #4f46e5; /* primary-500 */
    ring: 1px;
    ring-color: #4f46e5;
}

/* Divider */
.modal-form-divider {
    border-top: 1px solid #e5e7eb; /* gray-200 */
    margin: 1.5rem 0;
}

/* Info Box */
.modal-info-box {
    background-color: #eff6ff; /* blue-50 */
    border: 1px solid #bfdbfe; /* blue-200 */
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: start;
}

.modal-info-box-icon {
    flex-shrink: 0;
    height: 1.25rem;
    width: 1.25rem;
    color: #3b82f6; /* blue-500 */
    margin-right: 0.75rem;
}

.modal-info-box-text {
    font-size: 0.875rem;
    color: #1e40af; /* blue-800 */
}

/* Warning Box */
.modal-warning-box {
    background-color: #fef3c7; /* yellow-50 */
    border: 1px solid #fcd34d; /* yellow-300 */
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: start;
}

.modal-warning-box-icon {
    flex-shrink: 0;
    height: 1.25rem;
    width: 1.25rem;
    color: #f59e0b; /* yellow-500 */
    margin-right: 0.75rem;
}

.modal-warning-box-text {
    font-size: 0.875rem;
    color: #92400e; /* yellow-900 */
}

/* Error Box */
.modal-error-box {
    background-color: #fee2e2; /* red-50 */
    border: 1px solid #fca5a5; /* red-300 */
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: start;
}

.modal-error-box-icon {
    flex-shrink: 0;
    height: 1.25rem;
    width: 1.25rem;
    color: #dc2626; /* red-600 */
    margin-right: 0.75rem;
}

.modal-error-box-text {
    font-size: 0.875rem;
    color: #991b1b; /* red-800 */
}

