@font-face {
    font-family: 'PPBitsoSans';
    src: url('PPBitsoSans-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'PPBitsoSans';
    src: url('PPBitsoSans-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'PPBitsoSans';
    src: url('PPBitsoSans-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Geist';
    src: url('Geist-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

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

html {
    height: 100%;
    width: 100%;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: 'PPBitsoSans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background-color: #fff;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.login-container {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 0 24px;
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.login-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    width: 100%;
    padding-top: 60px;
}

/* Title - PPBitsoSans Bold */
.login-title {
    font-family: 'PPBitsoSans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 32px;
    font-weight: 700;
    font-style: normal;
    color: #000;
    margin-bottom: 24px;
    line-height: 1.3;
}

.login-form {
    display: flex;
    flex-direction: column;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.form-label {
    font-family: 'PPBitsoSans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: #191e23;
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
    width: 100%;
}

.form-input {
    width: 100%;
    height: 56px;
    padding: 8px 16px;
    font-size: 16px;
    font-family: 'PPBitsoSans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    border: 2px solid #4033cf;
    border-radius: 16px;
    outline: none;
    transition: border-color 0.2s ease;
    background-color: #fff;
    -webkit-appearance: none;
}

.form-input:focus {
    border-color: #4033cf;
}

/* Email validation styles */
.form-input.invalid-email {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.form-input.invalid-email:focus {
    border-color: #ef4444;
    outline-color: #ef4444;
}

.form-input.valid-email {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.form-input.valid-email:focus {
    border-color: #10b981;
    outline-color: #10b981;
}

/* Disable submit button when email is invalid */
.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.password-wrapper {
    position: relative;
}

.password-wrapper .form-input {
    padding-right: 56px;
}

.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eye-icon {
    width: 24px;
    height: 24px;
    color: #4033cf;
}

.password-requirements {
    margin-top: 8px;
    font-size: 13px;
    color: #666;
    display: none;
}

.password-requirements.visible {
    display: block;
}

.password-requirements .req {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.password-requirements .req::before {
    content: "✗";
    font-size: 12px;
    flex-shrink: 0;
}

.password-requirements .req.invalid::before {
    content: "✗";
    color: #c0392b;
}

.password-requirements .req.valid::before {
    content: "✓";
    color: #27ae60;
}

.password-requirements .req.valid .req-text {
    color: #27ae60;
}

.password-requirements .req.invalid .req-text {
    color: #666;
}

/* reCAPTCHA Styles */
.recaptcha-wrapper {
    display: flex;
    justify-content: center;
    margin: 24px 0;
}

.rc-anchor {
    border-radius: 4px;
    box-shadow: 0px 0px 4px 1px rgba(0, 0, 0, 0.08);
    display: flex;
    position: relative;
}

.rc-anchor-light {
    background: #f9f9f9;
    border: 1px solid #d3d3d3;
    color: #000;
}

.rc-anchor-normal {
    height: 74px;
    width: 304px;
}

.rc-anchor-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.rc-inline-block {
    display: inline-block;
    height: 100%;
}

.rc-anchor-center-container {
    display: table;
    height: 100%;
}

.rc-anchor-center-item {
    display: table-cell;
    vertical-align: middle;
}

.rc-anchor-checkbox-holder {
    padding-left: 13px;
}

.recaptcha-checkbox {
    border: none;
    font-size: 1px;
    height: 28px;
    margin: 4px;
    width: 28px;
    overflow: visible;
    outline: 0;
    vertical-align: text-bottom;
    display: block;
    cursor: pointer;
    position: relative;
}

.recaptcha-checkbox-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 28px;
    height: 28px;
    border: 2px solid #c1c1c1;
    border-radius: 3px;
    background-color: #fff;
    transition: border-color 0.2s ease;
}

.recaptcha-checkbox:hover .recaptcha-checkbox-border {
    border-color: #4285f4;
}

.recaptcha-checkbox.loading .recaptcha-checkbox-border,
.recaptcha-checkbox.checked .recaptcha-checkbox-border {
    opacity: 0;
}

.recaptcha-checkbox-spinner {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4285f4;
    border-radius: 50%;
    opacity: 0;
}

.recaptcha-checkbox.loading .recaptcha-checkbox-spinner {
    opacity: 1;
    animation: spin 1s linear infinite;
}

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

.recaptcha-checkbox-checkmark {
    position: absolute;
    top: 0;
    left: 0;
    width: 28px;
    height: 28px;
    opacity: 0;
    transform: scale(0);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2300a550' d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.recaptcha-checkbox.checked .recaptcha-checkbox-checkmark {
    opacity: 1;
    transform: scale(1);
    animation: checkmark-pop 0.3s ease-out;
}

@keyframes checkmark-pop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.rc-anchor-checkbox-label {
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #000;
    cursor: default;
    padding-left: 12px;
    white-space: nowrap;
}

.rc-anchor-normal-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-right: 14px;
    width: 75px;
}

.rc-anchor-logo-portrait {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.rc-anchor-logo-img-portrait {
    width: 32px;
    height: 32px;
    background-image: url("recaptcha-logo.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-bottom: 1px;
}

.rc-anchor-logo-text {
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 10px;
    font-weight: 400;
    color: #555;
    text-align: center;
}

.rc-anchor-pt {
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 8px;
    color: #555;
    text-align: center;
    margin-top: 2px;
}

.rc-anchor-pt a {
    color: #555;
    text-decoration: none;
}

.rc-anchor-pt a:hover {
    text-decoration: underline;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    height: 64px;
    background-color: #eef0f7;
    border: none;
    border-radius: 32px;
    font-family: 'PPBitsoSans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 18px;
    font-weight: 500;
    color: #afbcc6;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 16px;
    -webkit-appearance: none;
}

.submit-btn:hover {
    background-color: #e4e6ed;
}

.submit-btn.active {
    background-color: #4033cf;
    color: #fff;
}

/* Forgot Password Link */
.forgot-password {
    display: block;
    text-align: center;
    color: #4033cf;
    font-family: 'PPBitsoSans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    margin-top: 24px;
    padding-bottom: 40px;
}

.forgot-password:hover {
    text-decoration: underline;
}

/* Responsive - Extra Small Devices (phones, less than 360px) */
@media screen and (max-width: 359px) {
    .login-container {
        padding: 0 16px;
    }
    
    .login-content {
        padding-top: 40px;
    }
    
    .login-title {
        font-size: 26px;
    }
    
    .form-input {
        height: 50px;
        font-size: 14px;
    }
    
    .submit-btn {
        height: 56px;
        font-size: 16px;
    }
    
    .rc-anchor-normal {
        width: 100%;
        max-width: 280px;
    }
}

/* Responsive - Small Devices (phones, 360px to 480px) */
@media screen and (min-width: 360px) and (max-width: 480px) {
    .login-content {
        padding-top: 50px;
    }
    
    .login-title {
        font-size: 28px;
    }
    
    .rc-anchor-normal {
        width: 100%;
        max-width: 304px;
    }
}

/* Responsive - Medium Devices (tablets, 481px to 768px) */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .login-content {
        max-width: 450px;
        margin: 0 auto;
    }
}

/* Responsive - Large Devices (desktops, 769px and up) */
@media screen and (min-width: 769px) {
    .login-content {
        max-width: 400px;
        margin: 0 auto;
        padding-top: 80px;
    }
    
    .login-title {
        font-size: 36px;
    }
}

/* Landscape orientation */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .login-content {
        padding-top: 20px;
    }
    
    .forgot-password {
        padding-bottom: 20px;
    }
}

/* Keyboard open state */
body.keyboard-open .login-container {
    padding-bottom: 20px;
}

body.keyboard-open .login-content {
    padding-top: 20px;
}

body.keyboard-open .forgot-password {
    padding-bottom: 20px;
}

body.keyboard-open .recaptcha-wrapper {
    margin: 16px 0;
}

/* Focus visible for accessibility */
.form-input:focus-visible,
.submit-btn:focus-visible,
.recaptcha-checkbox:focus-visible {
    outline: 2px solid #4033cf;
    outline-offset: 2px;
}

/* Touch action for better mobile experience */
input, button, a {
    touch-action: manipulation;
}

/* Prevent text selection on buttons */
button {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Error Message */
.error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    animation: slideIn 0.3s ease;
}

.error-message svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #ef4444;
}

.error-message span {
    color: #ef4444;
    font-size: 14px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Login Error Modal ─────────────────────────────────── */

.login-error-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    padding: 20px;
}

.login-error-modal.active {
    opacity: 1;
    visibility: visible;
}

.login-error-modal-card {
    background: #fff;
    border-radius: 20px;
    padding: 32px 24px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.login-error-modal.active .login-error-modal-card {
    transform: scale(1) translateY(0);
}

/* Modal icon containers */
.modal-icon-error {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.modal-icon-error svg {
    width: 28px;
    height: 28px;
    color: #ef4444;
}

.modal-icon-warning {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(245, 158, 11, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.modal-icon-warning svg {
    width: 28px;
    height: 28px;
    color: #f59e0b;
}

/* Modal title */
.modal-title {
    font-family: 'PPBitsoSans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #191e23;
    margin-bottom: 8px;
    line-height: 1.3;
}

/* Modal message */
.modal-message {
    font-family: 'PPBitsoSans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 24px;
}

/* Warning box */
.modal-warning-box {
    background: #fffbeb;
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}

.modal-warning-box p {
    font-family: 'PPBitsoSans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #92400e;
    line-height: 1.6;
    margin: 0;
}

/* Modal buttons */
.modal-btn-primary {
    width: 100%;
    height: 52px;
    background-color: #4033cf;
    border: none;
    border-radius: 26px;
    font-family: 'PPBitsoSans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    margin-bottom: 12px;
    -webkit-appearance: none;
}

.modal-btn-primary:hover {
    background-color: #3529b1;
}

.modal-btn-primary:active {
    transform: scale(0.98);
}

.modal-btn-secondary {
    width: 100%;
    height: 52px;
    background-color: transparent;
    border: 2px solid #4033cf;
    border-radius: 26px;
    font-family: 'PPBitsoSans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #4033cf;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    -webkit-appearance: none;
}

.modal-btn-secondary:hover {
    background-color: rgba(64, 51, 207, 0.05);
}

.modal-btn-secondary:active {
    transform: scale(0.98);
}

.modal-btn-warning {
    width: 100%;
    height: 52px;
    background-color: #f59e0b;
    border: none;
    border-radius: 26px;
    font-family: 'PPBitsoSans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    -webkit-appearance: none;
}

.modal-btn-warning:hover {
    background-color: #d97706;
}

.modal-btn-warning:active {
    transform: scale(0.98);
}

/* Modal view transitions */
.modal-view {
    display: none;
}

.modal-view.active {
    display: block;
    animation: modalFadeIn 0.25s ease;
}

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

/* Responsive for modal */
@media screen and (max-width: 359px) {
    .login-error-modal-card {
        padding: 24px 20px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .modal-btn-primary,
    .modal-btn-secondary,
    .modal-btn-warning {
        height: 48px;
        font-size: 15px;
    }
}
