/* Mastex SchoolOS — forms & page-specific patterns
   Tokens, typography, buttons, .content-card: design-system.css (load first) */

.form-styled {
    max-width: 700px;
}

/* ===== FORM GROUP ===== */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    font-size: var(--text-sm, 0.875rem);
    font-weight: 600;
    color: var(--text-primary, #e5e7eb);
    margin-bottom: 0.6rem;
    letter-spacing: 0.01em;
}

.form-group label.required::after {
    content: " *";
    color: #f97373;
}

/* ===== FORM INPUTS - UNIVERSAL STYLING ===== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="file"],
input[type="color"],
select,
textarea,
.form-control,
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-md, 8px);
    border: 1px solid var(--border-strong, rgba(148, 163, 184, 0.5));
    background: var(--surface-input, rgba(15, 23, 42, 0.98));
    color: var(--text-primary, #f3f4f6);
    font-family: inherit;
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: all 0.25s ease;
}

/* Placeholder styling */
input::placeholder,
textarea::placeholder {
    color: var(--text-muted, #6b7280);
    opacity: 1;
}

/* Focus state - enhanced */
input:focus,
select:focus,
textarea:focus,
.form-control:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-brand-500, #22c55e);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22), 0 2px 8px rgba(0, 0, 0, 0.2);
    background: rgba(15, 23, 42, 1);
}

/* Hover state */
input:hover,
select:hover,
textarea:hover,
.form-control:hover,
.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: rgba(148, 163, 184, 0.7);
}

/* Disabled state */
input:disabled,
select:disabled,
textarea:disabled,
.form-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(15, 23, 42, 0.7);
}

/* Error state - red */
input.error,
select.error,
textarea.error,
.form-control.error,
.is-invalid {
    border-color: #f87171 !important;
    box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.15);
}

input.error:focus,
select.error:focus,
textarea.error:focus,
.form-control.error:focus {
    box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.25), 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Success state - green */
input.success,
select.success,
textarea.success,
.form-control.success,
.is-valid {
    border-color: #4ade80 !important;
}

/* Readonly state */
input[readonly],
textarea[readonly],
.form-control[readonly] {
    background: rgba(30, 41, 59, 0.8);
    cursor: default;
}

/* ===== TEXTAREA ===== */
textarea,
.form-group textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

/* ===== SELECT DROPDOWN ===== */
select,
.form-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 3rem;
    cursor: pointer;
}

select:hover {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23e5e7eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* ===== FILE INPUT ===== */
input[type="file"] {
    padding: 0.75rem;
    cursor: pointer;
    border-style: dashed;
    background: rgba(15, 23, 42, 0.9);
}

input[type="file"]:hover {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.05);
}

/* ===== CHECKBOX & RADIO ===== */
input[type="checkbox"],
input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 0.6rem;
    cursor: pointer;
    accent-color: #22c55e;
    vertical-align: middle;
}

.checkbox-group,
.radio-group {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
}

.checkbox-group label,
.radio-group label {
    margin-bottom: 0;
    cursor: pointer;
    color: #e5e7eb;
}

/* ===== FORM HELP TEXT ===== */
.form-text,
.help-text,
small {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.5;
}

.text-muted {
    color: #6b7280;
}

/* Error text */
.form-error,
.invalid-feedback,
.error-message {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #f87171;
}

/* Form action bar: design-system.css (.form-actions) */
/* Buttons: design-system.css */

/* ===== UTILITY CLASSES ===== */
.mt-sm { margin-top: 0.6rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 1.5rem; }

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

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===== INFO BOX ===== */
.info-box {
    margin-top: 1.5rem;
    padding: 1.25rem;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    font-size: 0.9rem;
    color: #93c5fd;
}

.info-box strong {
    color: #60a5fa;
}

.info-box.success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.info-box.warning {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fcd34d;
}

/* ===== SECTION DIVIDER ===== */
.section-divider {
    margin: 2rem 0;
    border: none;
    border-top: 1px solid rgba(148, 163, 184, 0.3);
}

.section-subtitle {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #e5e7eb;
}

/* ===== MESSAGE STYLES ===== */
.messages {
    margin-bottom: 1.5rem;
}

.message-box {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.message-box.success,
.messages .success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-left: 4px solid #22c55e;
}

.message-box.error,
.messages .error {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
    border-left: 4px solid #ef4444;
}

.message-box.warning,
.messages .warning {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border-left: 4px solid #f59e0b;
}

/* ===== DETAILS ===== */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.detail-card {
    padding: 1rem;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.detail-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.detail-value {
    font-size: 1rem;
    font-weight: 500;
    color: #f3f4f6;
}

/* ===== TAGS ===== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tag-paid {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.tag-unpaid {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.4);
}

.tag-success {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

/* ===== LINKS ===== */
a,
.content-link {
    color: #22c55e;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover,
.content-link:hover {
    color: #4ade80;
    text-decoration: underline;
}

/* ===== PROGRESS ===== */
.progress-fees-collected { width: 75%; }
.progress-fees-outstanding { width: 25%; }

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.95);
    display: none; /* Changed from visibility:hidden for better reliability */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay .spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(34, 197, 94, 0.2);
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-overlay .loading-text {
    margin-top: 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: #e5e7eb;
}

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

/* ===== TABLE CARD ===== */
.table-card-scroll {
    overflow-x: auto;
}

.table-card-scroll table {
    width: 100%;
    border-collapse: collapse;
}

.table-card-scroll th,
.table-card-scroll td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.table-card-scroll th {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(15, 23, 42, 0.8);
}

.table-card-scroll td {
    font-size: 0.9rem;
    color: #e5e7eb;
}

.table-card-scroll tr:hover {
    background: rgba(34, 197, 94, 0.05);
}

/* ===== CALENDAR/RESULT STYLES ===== */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.calendar-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.result-section {
    margin-top: 2rem;
}

.result-section-title {
    margin-bottom: 0.75rem;
    color: #22c55e;
    font-weight: 600;
}

.result-score-input {
    width: 80px;
    padding: 0.5rem 0.75rem;
}

.result-actions {
    margin-top: 1.5rem;
    text-align: right;
}

/* ===== FORM HEADING ===== */
.form-heading {
    margin: 0 0 1.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #e5e7eb;
}

/* ===== LOGIN LINK ===== */
.login-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: #6b7280;
}
