/* ===================================
   FORM STYLES FOR EDUFLOW
   Professional form layouts & validation assets/css/forms.css
   =================================== */

/* ─── Form Container ─── */
.form-container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem;
    animation: fadeIn 0.5s ease-out;
}

.form-header {
    margin-bottom: 2.5rem;
    text-align: center;
}

.form-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.form-header p {
    color: var(--gray-600);
    font-size: 1rem;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-base);
    margin-bottom: 1.5rem;
}

.btn-back:hover {
    background: var(--gray-200);
    transform: translateX(-3px);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
}

/* ─── Alert Messages ─── */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-icon {
    font-size: 1.25rem;
}

.alert-content {
    flex: 1;
    line-height: 1.5;
}

.alert-error {
    background: #fef2f2;
    border-left: 4px solid var(--danger);
    color: #991b1b;
}

.alert-success {
    background: #f0fdf4;
    border-left: 4px solid var(--success);
    color: #166534;
}

.alert-warning {
    background: #fffbeb;
    border-left: 4px solid var(--warning);
    color: #92400e;
}

/* ─── Form Sections ─── */
.form-section {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--gray-200);
}

.form-section:last-of-type {
    border-bottom: none;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-description {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

/* ─── Form Groups ─── */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 0.925rem;
}

label.required::after {
    content: ' *';
    color: var(--danger);
    font-weight: 600;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--white);
    color: var(--gray-900);
    transition: all var(--transition-base);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-input:disabled {
    background: var(--gray-50);
    cursor: not-allowed;
    color: var(--gray-500);
}

/* Input validation states */
.form-input.is-invalid {
    border-color: var(--danger);
}

.form-input.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-input.is-valid {
    border-color: var(--success);
}

.form-input.is-valid:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* ─── Form Hints & Notes ─── */
.form-hint {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.825rem;
    color: var(--gray-500);
    line-height: 1.4;
}

.form-note {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-left: 3px solid var(--primary-blue);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.link-primary {
    color: var(--primary-blue);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition-base);
}

.link-primary:hover {
    border-bottom-color: var(--primary-blue);
}

/* ─── Checkboxes ─── */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-base);
}

.checkbox-label:hover {
    background: var(--white);
    border-color: var(--primary-blue);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--primary-blue);
}

.checkbox-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.checkbox-text strong {
    color: var(--gray-900);
    font-weight: 600;
}

.checkbox-text small {
    color: var(--gray-600);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* ─── Form Actions ─── */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-200);
}

.btn-primary,
.btn-secondary {
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
    color: var(--white);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #1e3a8a);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 2px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-icon {
    font-size: 1.1rem;
}

/* ─── Select Dropdowns ─── */
select.form-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    appearance: none;
}

select.form-input:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232563eb' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* ─── Textarea ─── */
textarea.form-input {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

/* ─── Error Messages ─── */
.field-error {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.825rem;
    color: var(--danger);
    font-weight: 500;
}

/* ─── Loading State ─── */
.form-input:disabled,
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

button.loading {
    position: relative;
    color: transparent;
}

button.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid var(--white);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .form-container {
        padding: 1.5rem;
    }

    .form-header h2 {
        font-size: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions button {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .form-container {
        padding: 1.25rem;
    }

    .form-section {
        padding-bottom: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }
}