/* STS Auth Pages - Professional Styling */

:root {
    --primary-color: #0d6efd;
    --primary-dark: #0a58ca;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-bg: #f8f9fa;
    --card-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1);
    --card-hover-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Auth pages: vertically centre the card in the full viewport */
body.auth-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.auth-page .sts-page-content {
    flex: 1;
    display: flex;
    align-items: center;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

body.auth-page .sts-page-content > .container {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    width: 100%;
}

/* Fixed footer on auth pages */
body.auth-page .sts-footer {
    flex-shrink: 0;
    /* Cancel the mobile-nav bottom padding that applies globally at ≤991px */
    padding-bottom: 1rem !important;
    padding-top: 1rem !important;
}

.auth-container {
    padding-top: 0;
    padding-bottom: 0;
}

.auth-card {
    background: var(--bs-body-bg, white);
    border-radius: 1rem;
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.25s ease;
    border: none;
    overflow: hidden;
}

/* Auth pages: suppress card lift on hover */
.auth-card:hover {
    box-shadow: var(--card-hover-shadow);
    transform: none;
}

.auth-card-body {
    padding: 2rem !important;
}

.auth-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.auth-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    box-shadow: 0 0.25rem 0.5rem rgba(13, 110, 253, 0.3);
}

.auth-icon i {
    font-size: 2rem;
    color: white;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.375rem;
}

.auth-subtitle {
    color: #6c757d;
    font-size: 0.875rem;
    margin-bottom: 0;
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-control {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border-radius: 0.5rem;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

.btn-auth {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

@media (prefers-reduced-motion: reduce) {
    .btn-auth { transition: none; }
    .btn-auth:hover { transform: none; }
    .auth-card { transition: none; }
    .fade-in-up { animation: none; }
}

.btn-auth i {
    margin-right: 0.5rem;
}

.btn-resend {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.alert-auth {
    border-radius: 0.75rem;
    border: none;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.alert-auth i {
    margin-right: 0.5rem;
}

.alert-success-custom {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-left: 4px solid var(--success-color);
}

.alert-danger-custom {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-left: 4px solid var(--danger-color);
}

.alert-warning-custom {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border-left: 4px solid var(--warning-color);
}

.auth-divider {
    margin: 2rem 0;
    border-top: 2px solid #e9ecef;
    position: relative;
}

.auth-divider::before {
    content: 'OR';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bs-body-bg, white);
    padding: 0 1rem;
    color: #6c757d;
    font-weight: 600;
    font-size: 0.875rem;
}

.auth-links {
    text-align: center;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.auth-links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.otp-input {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5rem;
    padding: 1rem;
}

.resend-timer {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--light-bg);
    border-radius: 0.5rem;
    font-weight: 600;
    color: #6c757d;
}

.resend-timer.active {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: var(--primary-color);
}

.verify-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 2rem;
    color: var(--success-color);
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.verify-badge i {
    margin-right: 0.5rem;
}

.unverified-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 2rem;
    color: #e65100;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.unverified-badge i {
    margin-right: 0.5rem;
}

.email-info {
    background: var(--light-bg);
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
    border-left: 4px solid var(--primary-color);
}

.email-info strong {
    color: var(--primary-color);
}

.password-strength {
    margin-top: 0.5rem;
}

.password-strength-bar {
    height: 4px;
    border-radius: 2px;
    background: #e9ecef;
    transition: all 0.3s ease;
}

.password-strength-bar.weak {
    width: 33%;
    background: var(--sts-danger, var(--danger-color, #dc3545));
}

.password-strength-bar.medium {
    width: 66%;
    background: var(--sts-warning, var(--warning-color, #ffc107));
}

.password-strength-bar.strong {
    width: 100%;
    background: var(--sts-success, var(--success-color, #198754));
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
/* Tablet (768px): tighten card padding */
@media (max-width: 768px) {
    .auth-container {
        padding-top: 0;
        padding-bottom: 0;
    }

    .auth-card-body {
        padding: 1.75rem !important;
    }

    .auth-icon {
        width: 52px;
        height: 52px;
    }

    .auth-icon i {
        font-size: 1.6rem;
    }

    .auth-title {
        font-size: 1.35rem;
    }

    .otp-input {
        font-size: 1.25rem;
        letter-spacing: 0.25rem;
    }
}

/* Mobile phone (480px): minimal padding, compact header */
@media (max-width: 480px) {
    .auth-container {
        padding-top: 0;
        padding-bottom: 0;
    }

    .auth-card-body {
        padding: 1.25rem !important;
    }

    .auth-header {
        margin-bottom: 1rem;
    }

    .auth-icon {
        width: 44px;
        height: 44px;
        margin-bottom: 0.5rem;
    }

    .auth-icon i {
        font-size: 1.35rem;
    }

    .auth-title {
        font-size: 1.2rem;
    }

    .auth-logo {
        max-width: 120px !important;
    }

    .btn-auth {
        padding: 0.75rem 1rem;
    }
}

/* Animation Classes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease-out;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
}

.toast-custom {
    min-width: 300px;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-custom.success {
    border-left-color: var(--success-color);
}

.toast-custom.error {
    border-left-color: var(--danger-color);
}

.toast-custom.warning {
    border-left-color: var(--warning-color);
}

/* ── Mobile auth optimisation (portrait phones) ── */
@media (max-width: 575.98px) {
    .auth-container {
        padding-top: 0;
        padding-bottom: 0;
    }

    .auth-card-body {
        padding: 1.25rem !important;
    }

    .auth-header {
        margin-bottom: 1rem;
    }

    /* override inline style="max-width:400px" on logo img */
    .auth-logo {
        max-width: 160px !important;
    }

    .auth-icon {
        width: 52px;
        height: 52px;
        margin-bottom: 0.4rem;
    }

    .auth-icon i {
        font-size: 1.4rem;
    }

    .auth-title {
        font-size: 1.25rem;
    }

    .auth-subtitle {
        font-size: 0.82rem;
        margin-bottom: 0;
    }

    /* tighten form field gaps inside auth cards */
    .auth-card-body .mb-3 {
        margin-bottom: 0.5rem !important;
    }

    .auth-card-body .mb-4 {
        margin-bottom: 0.65rem !important;
    }

    .auth-divider {
        margin: 0.6rem 0;
    }

    .auth-links {
        font-size: 0.82rem;
    }

    .auth-links p {
        margin-bottom: 0.25rem;
    }

    .btn-auth {
        padding: 0.65rem 1.25rem;
        font-size: 0.9rem;
    }
}

/* Extra-tight for very short screens (e.g. landscape phones or small portrait) */
@media (max-height: 680px) and (max-width: 575.98px) {
    body.auth-page .sts-page-content {
        align-items: flex-start;
    }
    .auth-container {
        padding-top: 0;
        padding-bottom: 0;
    }

    .auth-logo {
        max-width: 110px !important;
    }

    .auth-header {
        margin-bottom: 0.5rem;
    }

    .auth-divider {
        margin: 0.35rem 0;
    }

    .auth-card-body .mb-3 {
        margin-bottom: 0.35rem !important;
    }
}
