/* ===================================
   CSS Variables - Matching Design
   =================================== */

/* ===================================
   Reset & Base
   =================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--gray-900);
}

/* ===================================
   Main Layout
   =================================== */

.auth-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--blue-50) 0%, var(--indigo-100) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

/* ===================================
   Logo Section
   =================================== */

.logo-section {
    text-align: center;
    margin-bottom: 1rem;
}

.school-name {
    font-size: 1.25rem;
    line-height: 1.75rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.portal-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--blue-100);
    color: var(--blue-700);
    font-size: 0.75rem;
    line-height: 1rem;
    border-radius: 9999px;
}

/* ===================================
   Auth Card
   =================================== */

.auth-card {
    width: 100%;
    max-width: 480px;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 2rem;
}

/* ===================================
   Progress Bar
   =================================== */

.progress-bar-container {
    margin-bottom: 1.5rem;
}

.progress-bar {
    height: 4px;
    background-color: var(--gray-200);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--blue-600);
    transition: width 0.3s ease;
}

/* ===================================
   Screen Management
   =================================== */

.auth-screen {
    display: none;
    animation: fadeIn 0.2s ease-in-out;
}

.auth-screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

/* ===================================
   Auth Header
   =================================== */

.auth-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.btn-back {
    background: transparent;
    border: none;
    padding: 0.5rem;
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.btn-back:hover {
    background-color: var(--gray-100);
}

.step-text {
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* ===================================
   Typography
   =================================== */

.screen-header {
    margin-bottom: 1.5rem;
}

.screen-title {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.screen-title-blue {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 600;
    color: var(--blue-600);
    margin-bottom: 0.5rem;
}

.screen-subtitle {
    font-size: 0.9375rem;
    line-height: 1.5rem;
    color: var(--gray-600);
}

.card-content-padded {
    padding: 0.5rem 0;
}

/* ===================================
   Profile Selection
   =================================== */

.profile-selection-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2rem;
}

.profile-card {
    width: 100%;
    padding: 1.5rem;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.profile-card:hover {
    border-color: var(--blue-600);
    background-color: var(--blue-50);
}

.profile-card-inner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.profile-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.5rem;
    transition: background-color 0.2s;
}

.profile-icon-learner {
    background-color: var(--blue-100);
    color: var(--blue-600);
}

.profile-card:hover .profile-icon-learner {
    background-color: var(--blue-600);
    color: white;
}

.profile-icon-parent {
    background-color: var(--indigo-100);
    color: var(--indigo-600);
}

.profile-card:hover .profile-icon-parent {
    background-color: var(--indigo-600);
    color: white;
}

.profile-content {
    flex: 1;
}

.profile-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.profile-description {
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--gray-600);
    margin: 0;
}

/* ===================================
   Forms
   =================================== */

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    width: 100%;
}

.form-label {
    display: block;
    font-size: 0.9375rem;
    line-height: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
    font-weight: 500;
}

.form-control {
    width: 100%;
    height: 48px;
    padding: 0 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
    background: white;
    color: var(--gray-900);
}

.form-control:focus {
    outline: none;
    border-color: var(--blue-600);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.form-control.error {
    border-color: var(--red-500);
}

.form-control.error:focus {
    border-color: var(--red-500);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-control.success {
    border-color: var(--green-500);
}

.helper-text {
    font-size: 0.8125rem;
    line-height: 1.25rem;
    color: var(--gray-500);
    margin-top: 0.5rem;
}

.error-text {
    font-size: 0.8125rem;
    line-height: 1.25rem;
    color: var(--red-500);
    margin-top: 0.5rem;
    display: none;
}

.error-text.show {
    display: block;
}

/* ===================================
   Buttons
   =================================== */

.btn-primary-auth {
    width: 100%;
    height: 52px;
    background-color: var(--blue-600);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary-auth:hover:not(:disabled) {
    background-color: var(--blue-700);
}

.btn-primary-auth:disabled {
    background-color: var(--gray-300);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary-auth {
    width: 100%;
    height: 52px;
    background-color: var(--gray-100);
    color: var(--gray-700);
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.btn-secondary-auth:hover {
    background-color: var(--gray-200);
}

.btn-link-centered {
    width: 100%;
    background: transparent;
    color: var(--gray-600);
    border: none;
    font-size: 0.9375rem;
    line-height: 1.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0.75rem;
    margin-top: 0.5rem;
    text-align: center;
}

.btn-link-centered:hover {
    color: var(--gray-900);
}

/* ===================================
   Icon Circles
   =================================== */

.screen-center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}

.icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.icon-circle-blue {
    background-color: var(--blue-100);
    color: var(--blue-600);
}

.icon-circle-success {
    background-color: var(--green-50);
    color: var(--green-600);
}

.icon-circle-success-large {
    width: 96px;
    height: 96px;
    background-color: var(--blue-600);
    color: white;
    font-size: 3rem;
}

.icon-circle-small {
    width: 56px;
    height: 56px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.icon-circle-blue-small {
    background-color: var(--blue-100);
    color: var(--blue-600);
}

.text-center {
    text-align: center;
}

/* ===================================
   Email Display Box
   =================================== */

.email-display-box {
    background-color: var(--gray-50);
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
    width: 100%;
    text-align: center;
}

.email-label {
    font-size: 0.8125rem;
    line-height: 1.25rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.email-value {
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

/* ===================================
   Info Box
   =================================== */

.info-box {
    background-color: var(--blue-50);
    border-radius: 0.5rem;
    padding: 1rem;
}

.info-box-title {
    font-size: 0.9375rem;
    line-height: 1.5rem;
    font-weight: 600;
    color: var(--blue-700);
    margin-bottom: 0.5rem;
}

.info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-list li {
    font-size: 0.875rem;
    line-height: 1.5rem;
    color: var(--blue-700);
    padding-left: 1.25rem;
    position: relative;
    margin-bottom: 0.25rem;
}

.info-list li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--blue-600);
    font-weight: bold;
}

.info-list li:last-child {
    margin-bottom: 0;
}

/* ===================================
   Terms & Conditions Box
   =================================== */

.terms-box {
    background-color: var(--gray-50);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.checkbox-group:last-child {
    margin-bottom: 0;
}

.custom-checkbox {
    width: 20px;
    height: 20px;
    margin-top: 0.125rem;
    cursor: pointer;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    background-color: white;
    position: relative;
    transition: all 0.2s;
}

.custom-checkbox:checked {
    background-color: var(--blue-600);
    border-color: var(--blue-600);
}

.custom-checkbox:checked::after {
    content: '✓';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.custom-checkbox:hover {
    border-color: var(--blue-600);
}

.checkbox-label {
    font-size: 0.875rem;
    line-height: 1.375rem;
    color: var(--gray-700);
    cursor: pointer;
    flex: 1;
}

.link-blue {
    color: var(--blue-600);
    text-decoration: none;
    font-weight: 500;
}

.link-blue:hover {
    text-decoration: underline;
}

/* ===================================
   Verification Summary
   =================================== */

.verification-summary {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.summary-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
}

.summary-item-success {
    background-color: var(--green-50);
}

.summary-item-info {
    background-color: var(--blue-50);
}

.summary-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.summary-item-success .summary-icon {
    color: var(--green-600);
}

.summary-item-info .summary-icon {
    color: var(--blue-600);
}

.summary-content {
    flex: 1;
}

.summary-title {
    font-size: 0.9375rem;
    line-height: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.125rem;
}

.summary-text {
    font-size: 0.8125rem;
    line-height: 1.25rem;
    color: var(--gray-600);
    margin: 0;
}

/* ===================================
   Next Steps Box
   =================================== */

.next-steps-box {
    background-color: #fffbeb;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.next-steps-title {
    font-size: 0.9375rem;
    line-height: 1.5rem;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 0.5rem;
}

.next-steps-list {
    margin: 0;
    padding-left: 1.25rem;
    color: #92400e;
}

.next-steps-list li {
    font-size: 0.875rem;
    line-height: 1.5rem;
    margin-bottom: 0.25rem;
}

.next-steps-list li:last-child {
    margin-bottom: 0;
}

/* ===================================
   Code Input (6-digit)
   =================================== */

.code-input-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.code-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    border: 2px solid var(--gray-300);
    border-radius: 0.5rem;
    background: white;
    color: var(--gray-900);
    transition: all 0.2s;
}

.code-input:focus {
    outline: none;
    border-color: var(--blue-600);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.code-input.filled {
    border-color: var(--blue-600);
    background-color: var(--blue-50);
}

.resend-text {
    text-align: center;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--gray-500);
    margin: 1rem 0 0 0;
}

/* ===================================
   Password Input
   =================================== */

.password-wrapper {
    position: relative;
}

.password-wrapper .form-control {
    padding-right: 3rem;
}

.password-toggle-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.password-toggle-btn:hover {
    color: var(--gray-700);
}

/* ===================================
   Password Requirements Checklist
   =================================== */

.password-requirements {
    margin: 1rem 0;
    padding: 0;
}

.requirement-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}

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

.requirement-circle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    background-color: white;
    flex-shrink: 0;
    transition: all 0.2s;
    position: relative;
}

.requirement-item.met .requirement-circle {
    border-color: var(--green-500);
    background-color: var(--green-500);
}

.requirement-item.met .requirement-circle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: white;
    border-radius: 50%;
}

.requirement-text {
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--gray-600);
    transition: color 0.2s;
}

.requirement-item.met .requirement-text {
    color: var(--green-600);
}

/* ===================================
   Loading Spinner
   =================================== */

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

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

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 576px) {
    .auth-wrapper {
        padding: 1rem 0.75rem;
    }

    .logo-section {
        margin-bottom: 1.5rem;
    }

    .school-name {
        font-size: 1.125rem;
    }

    .auth-card {
        padding: 1.5rem;
        max-width: 100%;
    }

    .screen-title {
        font-size: 1.375rem;
        line-height: 1.875rem;
    }

    .profile-card {
        padding: 1.25rem;
    }

    .profile-icon-box {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .code-input {
        width: 42px;
        height: 52px;
        font-size: 1.25rem;
    }

    .code-input-group {
        gap: 0.375rem;
    }
}

/* custom css */

.api-alert {
    margin-top: 10px;
    padding: 10px;
    border-radius: 6px;
    font-size: 14px;
}

.api-alert.success {
    background: #e6f9ed;
    color: #1a7f37;
    border: 1px solid #b7ebc6;
}

.api-alert.error {
    background: #fdecea;
    color: #b42318;
    border: 1px solid #f5c2c7;
}

.form-loader {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #555;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 3px solid #e0e0e0;
    border-top: 3px solid #4f46e5;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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