/* Authentication Modal Styles */

/* Modal Overlay */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Modal Container */
.auth-modal {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 1.25rem;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 40px rgba(22, 163, 74, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    max-width: 22rem;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(22, 163, 74, 0.1);
}

/* Profile Modal - Wider */
.profile-modal {
    max-width: 32rem;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.modal-header {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(22, 163, 74, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.05) 0%, transparent 100%);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 0.5rem;
    color: #6b7280;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background-color: rgba(22, 163, 74, 0.1);
    color: #16a34a;
    transform: rotate(90deg);
}

/* Modal Body */
.modal-body {
    padding: 1.25rem;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 1.25rem;
    background: #f3f4f6;
    padding: 0.25rem;
    border-radius: 0.625rem;
}

.auth-tab {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.auth-tab.active {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.auth-tab:not(.active) {
    background-color: transparent;
    color: #374151;
}

.auth-tab:hover:not(.active) {
    background-color: rgba(22, 163, 74, 0.1);
    color: #16a34a;
}

/* Form Styles */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
}

.form-input {
    padding: 0.625rem 0.875rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    transition: all 0.25s ease;
    width: 100%;
    box-sizing: border-box;
    background: #fafafa;
}

.form-input:focus {
    outline: none;
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15), 0 0 20px rgba(22, 163, 74, 0.1);
    background: white;
}

.form-input::placeholder {
    color: #9ca3af;
    font-size: 0.875rem;
}

.form-select {
    padding: 0.625rem 0.875rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    background-color: #fafafa;
    cursor: pointer;
    transition: all 0.25s ease;
    width: 100%;
    box-sizing: border-box;
}

.form-select:focus {
    outline: none;
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15), 0 0 20px rgba(22, 163, 74, 0.1);
    background: white;
}

/* Button Styles */
.btn-primary {
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.35);
}

.btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-secondary {
    padding: 0.75rem 1.25rem;
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
    border-color: #d1d5db;
}

/* Google Button */
.btn-google {
    padding: 0.625rem 1rem;
    background-color: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
}

.btn-google:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-google img {
    width: 1.125rem;
    height: 1.125rem;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: #e5e7eb;
}

.auth-divider span {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Link Styles */
.auth-link {
    color: #16a34a;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.auth-link:hover {
    color: #15803d;
    text-decoration: underline;
}

/* Forgot Password */
.forgot-password-link {
    text-align: right;
    margin-top: -0.5rem;
}

/* Profile Section */
.profile-section {
    margin-bottom: 1.5rem;
}

.profile-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #16a34a;
}

/* Grade Grid */
.grades-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 640px) {
    .grades-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* User Info Display */
.user-info-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: #f0fdf4;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.user-avatar-large {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background-color: #16a34a;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.user-avatar-large img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.user-details h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 0.25rem 0;
}

.user-details p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

/* Navbar Auth Buttons */
.nav-auth-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-auth-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
}

.nav-auth-btn.login-btn {
    background-color: #16a34a;
    color: white;
}

.nav-auth-btn.login-btn:hover {
    background-color: #15803d;
}

.nav-auth-btn.profile-btn {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.nav-auth-btn.profile-btn:hover {
    background-color: #e5e7eb;
}

.nav-user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
}

.nav-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Loading Spinner */
.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Mobile Responsive */
@media (max-width: 640px) {
    .auth-modal {
        margin: 0.5rem;
        max-height: 95vh;
    }
    
    .profile-modal {
        max-width: 100%;
    }
    
    .grades-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal-header h2 {
        font-size: 1.125rem;
    }
    
    .nav-auth-container {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Hidden utility - only for auth modals */
.auth-modal-overlay.hidden {
    display: none !important;
}

/* ============================================
   SweetAlert2 Custom Modern Styling
   ============================================ */
.swal2-popup {
    border-radius: 1.25rem !important;
    padding: 1.25rem !important;
    max-width: 340px !important;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 50px rgba(22, 163, 74, 0.15) !important;
    border: 1px solid rgba(22, 163, 74, 0.1) !important;
    animation: swalSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes swalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.swal2-backdrop-show {
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(8px) !important;
}

/* Ensure SweetAlert properly hides when closed */
.swal2-container.swal2-backdrop-hide {
    display: none !important;
}

body:not(.swal2-shown) .swal2-container {
    display: none !important;
}

.swal2-title {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: #111827 !important;
    padding: 0.5rem 0 !important;
    margin: 0 !important;
}

.swal2-html-container {
    font-size: 0.9375rem !important;
    color: #4b5563 !important;
    margin: 0.75rem 0 !important;
    padding: 0 0.5rem !important;
    line-height: 1.5 !important;
}

.swal2-icon {
    margin: 0.75rem auto !important;
    width: 4rem !important;
    height: 4rem !important;
    border-width: 3px !important;
}

.swal2-icon.swal2-success {
    border-color: #16a34a !important;
}

.swal2-icon.swal2-success .swal2-success-line-tip,
.swal2-icon.swal2-success .swal2-success-line-long {
    background-color: #16a34a !important;
}

.swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(22, 163, 74, 0.3) !important;
}

.swal2-icon.swal2-info {
    border-color: #0ea5e9 !important;
    color: #0ea5e9 !important;
}

.swal2-icon.swal2-warning {
    border-color: #f59e0b !important;
    color: #f59e0b !important;
}

.swal2-icon.swal2-error {
    border-color: #ef4444 !important;
}

.swal2-input,
.swal2-textarea {
    border: 1px solid #e5e7eb !important;
    border-radius: 0.625rem !important;
    padding: 0.625rem 0.875rem !important;
    font-size: 0.9375rem !important;
    transition: all 0.25s ease !important;
    background: #fafafa !important;
}

.swal2-input:focus,
.swal2-textarea:focus {
    border-color: #16a34a !important;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15), 0 0 20px rgba(22, 163, 74, 0.1) !important;
    background: white !important;
}

.swal2-input-label {
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    color: #374151 !important;
    margin-bottom: 0.25rem !important;
}

.swal2-confirm {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
    border-radius: 0.625rem !important;
    padding: 0.625rem 1.5rem !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25) !important;
    transition: all 0.25s ease !important;
}

.swal2-confirm:hover {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.35) !important;
}

.swal2-confirm:focus {
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.3), 0 4px 12px rgba(22, 163, 74, 0.25) !important;
}

.swal2-cancel {
    background: #f3f4f6 !important;
    color: #374151 !important;
    border-radius: 0.625rem !important;
    padding: 0.625rem 1.5rem !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    transition: all 0.25s ease !important;
}

.swal2-cancel:hover {
    background: #e5e7eb !important;
}

.swal2-actions {
    margin-top: 1rem !important;
    gap: 0.625rem !important;
}

.swal2-loader {
    border-color: #16a34a transparent #16a34a transparent !important;
}

/* Mobile responsive for SweetAlert */
@media (max-width: 480px) {
    .swal2-popup {
        max-width: 90% !important;
        padding: 1rem !important;
        margin: 0.5rem !important;
    }
    
    .swal2-title {
        font-size: 1.125rem !important;
    }
    
    .swal2-html-container {
        font-size: 0.875rem !important;
    }
    
    .swal2-icon {
        width: 3.5rem !important;
        height: 3.5rem !important;
    }
    
    .swal2-confirm,
    .swal2-cancel {
        padding: 0.5rem 1.25rem !important;
        font-size: 0.875rem !important;
    }
}
