/* ========================
   Global Reset
======================== */
* {
    box-sizing: border-box;
}

/* ========================
   Variables
======================== */
:root {
    --primary: #002B5B;
    --primary-hover: #013a7c;
    --bg-light: #f4f7fc;
    --bg-dark: #1e272e;
    --card-light: #ffffff;
    --card-dark: #2f3640;
    --text-light: #333333;
    --text-dark: #ffffff;
    --input-light: #ffffff;
    --input-dark: #353b48;
    --success: #27ae60;
    --success-hover: #219150;
}

/* ========================
   Base Styles
======================== */
body {
    font-family: Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-light);
    margin: 0;
    padding: 0;
    font-size: 1.05rem;
    transition: background-color 0.4s ease, color 0.4s ease;
}

body.dark {
    background-color: var(--bg-dark);
    color: var(--text-dark);
}

/* ========================
   Navbar
======================== */
.navbar {
    background-color: var(--primary);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.navbar .brand {
    display: flex;
    align-items: center;
}

.navbar img {
    height: 40px;
    margin-right: 10px;
}

.navbar h1 {
    font-size: 1.3rem;
    margin: 0;
}

.toggle {
    background: transparent;
    border: 2px solid white;
    color: white;
    padding: 8px 20px;
    border-radius: 50px;
    cursor: pointer;
}

/* ========================
   Page / Card
======================== */
.page-container {
    max-width: 1100px;
    margin: 30px auto;
    padding: 20px;
}

.form-container {
    background: var(--card-light);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

body.dark .form-container {
    background-color: var(--card-dark);
}

.form-container h2 {
    text-align: center;
    margin-bottom: 20px;
}

.form-container .logo {
    display: block;
    margin: 0 auto 10px;
    height: 60px;
}

/* ========================
   Grid Layout
======================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px 24px;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================
   Form Elements
======================== */
.form-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}

label {
    font-weight: bold;
    margin-bottom: 6px;
}

input,
select {
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 1rem;
}

body.dark input,
body.dark select {
    background-color: var(--input-dark);
    color: var(--text-dark);
    border-color: #555;
}

input:focus,
select:focus {
    outline: none;
    border-color: #3498db;
}

/* ========================
   OTP ROW FIX (MAIN ISSUE)
======================== */
.otp-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.otp-row input {
    flex: 1;
    min-width: 0; /* ðŸ”¥ critical fix */
}

.otp-btn {
    padding: 10px 16px;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* ========================
   Password Toggle
======================== */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    width: 100%;
    padding-right: 38px;
}

.toggle-password {
    position: absolute;
    right: 10px;
    cursor: pointer;
}

/* ========================
   Buttons / Actions
======================== */
.form-actions {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 20px;
}

.btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 12px 26px;
    border-radius: 6px;
    cursor: pointer;
}

.btn:hover {
    background: var(--success-hover);
}

.link {
    display: block;
    margin-top: 10px;
    color: #2980b9;
    text-decoration: none;
}

/* ========================
   Modal
======================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
}

.modal-content {
    position: relative; /* 👈 REQUIRED for X positioning */
    background: white;
    margin: 10% auto;
    padding: 25px;
    border-radius: 8px;
    max-width: 600px;
}

.close {
    position: absolute;
    top: 12px;
    right: 15px;
    font-size: 26px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    border: none;
    background: transparent;
}

.close:hover {
    color: red;
}

body.dark .modal-content {
    background: var(--card-dark);
    color: var(--text-dark);
}

body.dark .close {
    color: #ccc;
}

body.dark .close:hover {
    color: #ff7675;
}

/* ========================
   Waiting Overlay
======================== */
.waiting-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.overlay-content {
    background: white;
    padding: 25px;
    border-radius: 8px;
}

/* ========================
   Privacy Agreement Fix
======================== */
.privacy-group {
    grid-column: 1 / -1;
}

.privacy-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: normal;
    line-height: 1.4;
}

.privacy-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.privacy-label span {
    display: inline;
}

.privacy-label a {
    color: #2980b9;
    text-decoration: underline;
    cursor: pointer;
}

body.dark .privacy-label a {
    color: #74b9ff;
}
