/* ===== Theme Variables ===== */
:root {
    --bg-color: #f5f7fa;
    --text-color: #212529;
    --card-bg: #fff;
    --primary: #00456d;
    --primary-hover: #007ab7;
    --danger: #d9534f;
    --danger-hover: #c9302c;
    --shadow: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e9ecef;
    --card-bg: #1e1e1e;
    --primary: #85d6ff;
    --primary-hover: #1976d2;
    --danger: #ff4d4d;
    --danger-hover: #1e1919;
    --shadow: rgba(255, 255, 255, 0.08);
}

/* ===== Spinner Animation ===== */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

html,
body {
    background: var(--bg-color);
    color: var(--text-color);
    transition: background 0.3s, color 0.3s;
}

.auth-container,
.form-toggle button,
.auth-form,
input,
button,
.back-btn,
.forgot-password-link,
.terms-checkbox input[type="checkbox"] {
    background: var(--card-bg);
    color: var(--text-color);
    transition: background 0.3s, color 0.3s;
}
.auth-form h3 {
    text-align: center;
    font-size: 20px;
    text-transform: uppercase;
    margin-top: -1rem
}

.auth-form input,
.auth-form button {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1.5px solid #cfd8dc;
}

[data-theme="dark"] .auth-form input,
[data-theme="dark"] .auth-form button {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1.5px solid #23262f;
}

.auth-form input:focus {
    border-color: var(--primary);
    background: #fff;
    color: var(--text-color);
}

[data-theme="dark"] .auth-form input:focus {
    background: #23262f;
    color: var(--text-color);
}

.auth-form button {
    background: var(--primary);
    color: #fff;
}

.auth-form button:hover {
    background: var(--primary-hover);
}

[data-theme="dark"] .auth-form button {
    background: var(--primary);
    color: #fff;
}

[data-theme="dark"] .auth-form button:hover {
    background: var(--primary-hover);
}

.back-btn {
    background: #f0f4f8;
    color: var(--primary);
    border: 1px solid #cfd8dc;
}

[data-theme="dark"] .back-btn {
    background: #23262f;
    color: var(--primary);
    border: 1px solid #23262f;
}

.forgot-password-link {
    color: var(--primary);
}

[data-theme="dark"] .forgot-password-link {
    color: var(--primary-hover);
}

input.valid {
    border-color: #28a745 !important;
    background: #eaffea;
}

[data-theme="dark"] input.valid {
    background: #1e2e1e;
}

input.invalid {
    border-color: #d9534f !important;
    background: #ffeaea;
}

[data-theme="dark"] input.invalid {
    background: #2e1e1e;
}

.auth-msg,
.auth-msg-pwd {
    color: #ff0000;
    background: transparent;
}

[data-theme="dark"] .auth-msg,
[data-theme="dark"] .auth-msg-pwd {
    color: #ff6868;
}

.hidden {
    display: none !important;
}

/* ===== Theme Variables ===== */
:root {
    --bg-color: #f5f7fa;
    --text-color: #212529;
    --card-bg: #fff;
    --primary: #00456d;
    --primary-hover: #007ab7;
    --danger: #d9534f;
    --danger-hover: #c9302c;
    --shadow: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e9ecef;
    --card-bg: #1e1e1e;
    --primary: #00456d;
    --primary-hover: #007ab7;
    --danger: #ff4d4d;
    --danger-hover: #1e1919;
    --shadow: rgba(255, 255, 255, 0.08);
}


html,
body {
    touch-action: manipulation;
    /* Prevent double-tap zoom */
    overscroll-behavior: contain;
    /* Prevent two finger zoom on some browsers */
}

body.mobile .auth-form input,
body.mobile .auth-form button {
    font-size: 16px;
    /* Prevent zoom on iOS */
    padding: 0.5rem;
    /* Prevent pinch zoom on supported browsers */
    touch-action: manipulation;
}

/* Prevent zoom on input focus for all devices */
.auth-form input,
.auth-form button {
    font-size: 16px !important;
    touch-action: manipulation;
}

/* ===== Desktop Styles ===== */
body.desktop {
    font-family: "Segoe UI", Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    padding: 1rem;
}

body.desktop .auth-container {
    max-width: 400px;
    margin: 3rem auto;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 12px var(--shadow);
}

body.desktop .auth-form input,
body.desktop .auth-form button {
    font-size: 1rem;
    padding: 0.75rem;
}

body.desktop .form-toggle button {
    font-size: 1rem;
    padding: 0.7rem;
}

/* ===== Mobile Styles ===== */
body.mobile {
    font-family: "Segoe UI", Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    padding: 0.5rem;
}

body.mobile .auth-container {
    max-width: 98vw;
    margin: 0.5rem auto;
    padding: 0.7rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow);
}

body.mobile .auth-form input,
body.mobile .auth-form button {
    font-size: 0.9rem;
    padding: 0.5rem;
}

body.mobile .form-toggle button {
    font-size: 0.95rem;
    padding: 0.4rem;
}

body.mobile .auth-form h2 {
    font-size: 1.1rem;
}

body.mobile .auth-form label {
    font-size: 1rem;
    margin-top: 0.7rem;
}

body.mobile #theme-toggle {
    font-size: 1.2rem;
    padding: 0.3rem 0.7rem;
}

/* ===== Shared Styles ===== */

.auth-container {
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
    min-height: 100px;
    width: 100%;
    max-width: 600px;
    margin: 2rem auto;
    padding: 1rem 1.5rem 2.5rem 1.5rem;
    border-radius: 20px;
    box-shadow: 0 6px 32px var(--shadow);
    gap: 2.5rem;
    transition: box-shadow 0.2s;
    margin-top: 4rem;
}

.form-toggle {
    display: flex;
    justify-content: center;
    width: 100%;
    gap: 3rem;
    margin-bottom: 2.2rem;
}

.form-toggle button {
    flex: 1;
    border: none;
    background: #e3eaf0;
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 0.9rem 0;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    outline: none;
}

.form-toggle button.active {
    background: var(--primary);
    color: #fff;
}
.form-toggle button:hover {
    background: var(--primary-hover);
    color: #fff;
}
.auth-form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 1.2rem;
    background: transparent;
    border-radius: 12px;
    box-sizing: border-box;
}

.auth-form h2 {
    text-align: center;
    margin-top: -2rem;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    text-transform: uppercase;
}
.auth-form label {
    font-size: 1.1rem;
    margin-bottom: 0.1rem;
    font-weight: 500;
}

.auth-form input {
    border: 1.5px solid #cfd8dc;
    border-radius: 8px;
    outline: none;
    transition: border 0.2s, background 0.3s, color 0.3s;
    background: #f8fafc;
    color: var(--text-color);
    font-size: 1.1rem;
    padding: 0.45rem 0.7rem;
    margin-bottom: 0.1rem;
    box-sizing: border-box;
    margin-top: -21.5px
}

.auth-form input:focus {
    border-color: var(--primary);
    background: #fff;
}

.auth-form button {
    margin-top: 1.2rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.08rem;
    cursor: pointer;
    padding: 0.9rem 0;
    transition: background 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.auth-form button:hover {
    background: var(--primary-hover);
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 0.2em;
    width: 100%;
}

.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
    flex: 1;
    padding-right: 4em;
}


.back-btn {
    margin-top: 0.7em;
    background: #f0f4f8;
    color: var(--primary);
    border: 1px solid #cfd8dc;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    padding: 0.7em 0;
}

.back-btn:hover {
    background: #e0e0e0;
}

.auth-msg {
    margin-top: -13px;
    text-align: center;
    color: #ff0000;
    font-size: 1.1rem;
}

.hidden {
    display: none !important;
}

.forgot-password-link {
    display: block;
    text-align: right;
    font-size: 1.1em;
    margin-top: -10px;
    margin-bottom: 0.7em;
    color: var(--primary, #025b00);
    text-decoration: none;
    cursor: pointer;
    font-weight: 700;
}

.forgot-password-link:hover {
    text-decoration: underline;
    color: #007ab7;
}

.terms-checkbox input[type="checkbox"] {
    margin-right: 0.5em;
    accent-color: var(--primary, #025b00);
}

.toggle-password {
    position: absolute;
    top: -130%;
    right: 1px;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    color: var(--primary, #00366d);
    height: 2.1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    width: 4rem;
}

.toggle-password:focus {
    outline: none;
}

/* ===== Phone Input Group with Country Code ===== */
.phone-input-group {
    display: flex;
    gap: 0.6rem;
    align-items: stretch;
    width: 100%;
    margin-bottom: 0.1rem;
}

.country-code-select {
    flex: 0 0 auto;
    min-width: 140px;
    padding: 0.45rem 0.7rem;
    border: 1.5px solid #cfd8dc;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text-color);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: border 0.2s, background 0.3s, color 0.3s;
    box-sizing: border-box;
    margin-top: -21.5px;
}

.country-code-select:focus {
    border-color: var(--primary);
    background: #fff;
}

[data-theme="dark"] .country-code-select {
    background: var(--card-bg);
    color: var(--text-color);
    border-color: #23262f;
}

[data-theme="dark"] .country-code-select:focus {
    background: #23262f;
    border-color: var(--primary);
}

.phone-input-group input[type="text"] {
    flex: 1;
    padding: 0.45rem 0.7rem;
    border: 1.5px solid #cfd8dc;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text-color);
    font-size: 1.1rem;
    outline: none;
    transition: border 0.2s, background 0.3s, color 0.3s;
    box-sizing: border-box;
    margin-top: -21.5px;
}

.phone-input-group input[type="text"]:focus {
    border-color: var(--primary);
    background: #fff;
}

[data-theme="dark"] .phone-input-group input[type="text"] {
    background: var(--card-bg);
    color: var(--text-color);
    border-color: #23262f;
}

[data-theme="dark"] .phone-input-group input[type="text"]:focus {
    background: #23262f;
    border-color: var(--primary);
}

.phone-input-group input[type="text"].valid {
    border-color: #28a745 !important;
    background: #eaffea;
}

[data-theme="dark"] .phone-input-group input[type="text"].valid {
    background: #1e2e1e;
}

.phone-input-group input[type="text"].invalid {
    border-color: #d9534f !important;
    background: #ffeaea;
}

[data-theme="dark"] .phone-input-group input[type="text"].invalid {
    background: #2e1e1e;
}

/* ===== Mobile Responsive for Phone Input ===== */
@media (max-width: 600px) {
    .phone-input-group {
        gap: 0.4rem;
    }

    .country-code-select {
        min-width: 85px;
        padding: 0.4rem 0.5rem;
        font-size: 0.85rem;
    }

    .phone-input-group input[type="text"] {
        padding: 0.4rem 0.5rem;
        font-size: 0.95rem;
        margin-top: -21.5px;
    }
}


.auth-form input.valid {
    border-color: #28a745 !important;
    background: #eaffea;
}

.auth-form input.invalid {
    border-color: #d9534f !important;
    background: #ffeaea;
}

/* Place below your .password-wrapper styles */
.auth-msg-pwd {
    margin-top: -13px;
    color: #ff0000;
    font-size: 1.1rem;
    width: 100%;
    display: block;
    position: static;
    text-align: center;
}

.auth-msg-phone {
    margin-top: -13px;
    color: #ff0000;
    font-size: 1.1rem;
    width: 100%;
    display: block;
    position: static;
    text-align: center;
}

/* ===== Desktop Password Toggle ===== */
@media (min-width: 710px) {
    .toggle-password {
        position: absolute;
        top: -160%;
        right: 1px;
        transform: translateY(-50%);
        background: none;
        border: none;
        cursor: pointer;
        font-size: 1.1em;
        color: var(--primary, #00366d);
        height: 2.073rem;
        display: flex;
        justify-content: center;
        align-items: center;
        font-weight: bold;
        width: 4rem;
    }

}

/* ===== Copyright Footer ===== */
.copyright-footer {
    margin-top: 1.8rem;
    padding: 3rem 2rem 2rem 2rem;
    color: var(--text-color);
    position: relative;
}

.copyright-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, 
        transparent 0%, 
        rgba(0, 0, 0, 0.15) 10%, 
        rgba(0, 0, 0, 0.15) 90%, 
        transparent 100%);
}

[data-theme="dark"] .copyright-footer::before {
    background: linear-gradient(to right, 
        transparent 0%, 
        rgba(255, 255, 255, 0.15) 10%, 
        rgba(255, 255, 255, 0.15) 90%, 
        transparent 100%);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto 2rem auto;
}

.footer-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

.footer-section p {
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
    opacity: 0.8;
    line-height: 1.5;
}

.footer-section ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-section ul li {
    margin: 0.5rem 0;
}

.footer-section a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.footer-section a:hover {
    opacity: 1;
    text-decoration: underline;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 1rem;
    opacity: 1;
    transition: all 0.3s;
}

.social-links a:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    text-decoration: none;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.85rem;
    opacity: 0.8;
}

.footer-bottom p {
    margin: 0;
    padding: 0;
}

.version {
    opacity: 0.6;
}

/* ===== Mobile Responsive Footer ===== */
@media (max-width: 768px) {
    .copyright-footer {
        margin-top: 2rem;
        margin-bottom: 4rem;
        padding: 2rem 1rem 1.5rem 1rem;
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .footer-section:first-child {
        grid-column: 1 / -1;
    }

    .footer-section:last-child {
        grid-column: 1 / -1;
    }

    .footer-section h4 {
        font-size: 1.05rem;
    }

    .footer-section p {
        font-size: 0.95rem;
    }

    .footer-section a {
        font-size: 0.95rem;
    }

    .social-links {
        justify-content: center;
        gap: 0.8rem;
    }

    .social-links a {
        width: 2.2rem;
        height: 2.2rem;
        font-size: 0.9rem;
    }

    .footer-bottom {
        padding-top: 1.5rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .copyright-footer {
        margin-top: 1.5rem;
        margin-bottom: 4rem;
        padding: 1.5rem 0.8rem 1rem 0.8rem;
    }

    .footer-content {
        gap: 1rem;
    }

    .footer-section h4 {
        font-size: 0.9rem;
        margin-bottom: 0.7rem;
    }

    .footer-section p {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .footer-section ul li {
        margin: 0.4rem 0;
    }

    .footer-section a {
        font-size: 0.8rem;
    }

    .social-links {
        gap: 0.6rem;
    }

    .social-links a {
        width: 2rem;
        height: 2rem;
        font-size: 0.85rem;
    }

    .footer-bottom {
        padding-top: 1rem;
        font-size: 0.75rem;
    }

    .footer-bottom p {
        line-height: 1.4;
    }
}

/* ===== Legal Pages Styling ===== */
.legal-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

.legal-section {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--text-color, #ccc);
}

.legal-section:last-child {
    border-bottom: none;
}

.legal-section h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1.5rem 0 1rem 0;
    line-height: 1.3;
}

.legal-section h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 1.2rem 0 0.8rem 0;
}

.legal-section p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.legal-section ul,
.legal-section ol {
    margin: 1rem 0 1rem 2rem;
    padding-left: 0;
}

.legal-section li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.highlight {
    background: rgba(0, 69, 109, 0.05);
    border-left: 4px solid var(--primary);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

[data-theme="dark"] .highlight {
    background: rgba(133, 214, 255, 0.08);
}

.highlight p {
    margin: 0;
}

.highlight strong {
    color: var(--primary);
    font-weight: 700;
}

@media (max-width: 768px) {
    .legal-container {
        padding: 1.5rem;
    }

    .legal-section h2 {
        font-size: 1.4rem;
    }

    .legal-section h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .legal-container {
        padding: 1rem;
    }

    .legal-section h2 {
        font-size: 1.2rem;
        margin: 1rem 0 0.8rem 0;
    }

    .legal-section {
        margin-bottom: 2rem;
    }

    .legal-section ul,
    .legal-section ol {
        margin: 0.8rem 0 0.8rem 1.5rem;
    }

    .highlight {
        padding: 1rem;
    }
}