:root {
    --primary: #1B1B1B;
    --secondary: #C89B5B;
    --accent: #E8D8C3;
    --success: #5E8B5A;
    --error: #D9534F;
    --background: #F8F6F2;
    --surface: #FFFDF9;
    --text: #2D2118;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background: var(--background);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 40px 20px;
}

.container {
    width: 100%;
    display: flex;
    justify-content: center;
}

.container .card.login-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
}

.back-link {
    position: absolute;
    top: 18px;
    left: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: #8A7B70;
    text-decoration: none;
}

.back-link:hover {
    color: var(--secondary);
}

.logo {
    display: block;
    width: 100px;
    margin: 0 auto 16px auto;
    object-fit: contain;
}

h2 {
    text-align: center;
    color: var(--primary);
    font-weight: 700;
    font-size: 26px;
    margin-bottom: 4px;
}

p {
    text-align: center;
    margin-bottom: 24px;
    color: #777;
    font-size: 14px;
}

/* PHP Session Error Box */
.alert-error {
    background-color: rgba(217, 83, 79, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
    text-align: center;
}

/* PHP Session Success Box */
.alert-success {
    background-color: rgba(94, 139, 90, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
    text-align: center;
}

.forgot-link {
    align-self: flex-end;
    margin-top: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--secondary);
    text-decoration: none;
}

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

.switch-link {
    text-align: center;
    margin-top: 18px;
    margin-bottom: 0;
    font-size: 13px;
    color: #777;
}

.switch-link a {
    color: var(--secondary);
    font-weight: 600;
    text-decoration: none;
}

.switch-link a:hover {
    text-decoration: underline;
}

/* ===== Login OTP verification page ===== */
.otp-input {
    letter-spacing: 10px;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
}

.otp-expiry {
    text-align: center;
    font-size: 12.5px;
    color: #777;
    margin: 4px 0 16px;
}

.btn-link {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 10px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--secondary);
    cursor: pointer;
    text-align: center;
}

.btn-link:hover {
    text-decoration: underline;
}

#resendCooldownMsg {
    display: block;
    text-align: center;
    font-size: 12.5px;
    color: #777;
    margin-top: 10px;
}

/* Form Styles */
#loginForm {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.full-width {
    width: 100%;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #E0E0E0;
    border-radius: 10px;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background-color: var(--surface);
    color: var(--text);
    appearance: none;
}

input::placeholder {
    color: #A0A0A0;
}

input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(200, 155, 91, 0.15);
}

/* Password Toggle Wrapper */
.password-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    width: 100%;
    padding-right: 75px; 
}

.password-wrapper .toggle-password {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    margin-top: 0;
    width: auto;
    background: var(--background);
    border: 1px solid var(--accent);
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    user-select: none;
}

.password-wrapper .toggle-password:hover {
    background: var(--secondary);
    color: #FFFFFF;
    border-color: var(--secondary);
}

.password-wrapper .toggle-password:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(200, 155, 91, 0.25);
}

/* Error States */
input.invalid {
    border-color: var(--error) !important;
}

.error-msg {
    color: var(--error);
    font-size: 11px;
    margin-top: 4px;
    min-height: 14px;
}


/* Customer registration terms/privacy checkbox */
#registerForm .checkbox-group {
    display: block;
    margin-top: 2px;
}

#registerForm .checkbox-group .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    font-size: 12.5px;
    line-height: 1.45;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
}

#registerForm .checkbox-group input[type="checkbox"] {
    width: 16px;
    min-width: 16px;
    height: 16px;
    margin: 1px 0 0;
    padding: 0;
    border: 1px solid #C9B8A5;
    border-radius: 4px;
    background: var(--surface);
    appearance: auto;
    -webkit-appearance: checkbox;
    box-shadow: none;
    cursor: pointer;
}

#registerForm .checkbox-group input[type="checkbox"]:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(200, 155, 91, 0.15);
}

#registerForm .checkbox-group .checkbox-label span {
    flex: 1;
}

#registerForm .checkbox-group .checkbox-label a {
    color: #1A56DB;
    font-weight: 600;
    text-decoration: underline;
}

#registerForm .checkbox-group .checkbox-label a:hover {
    color: #1749B8;
}

#registerForm .checkbox-group .error-msg {
    display: block;
    margin-left: 24px;
}

/* Button */
.btn {
    padding: 14px;
    background: var(--secondary);
    border: none;
    color: #FFFFFF;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.btn:hover {
    background: #b58747;
    transform: translateY(-1px);
}

/* --- Strict Modal Popup Styling --- */
.modal-overlay{
    position: fixed;
    inset: 0;
    background: rgba(27,27,27,.65);
    backdrop-filter: blur(5px);

    display:flex;
    justify-content:center;
    align-items:center;

    z-index:9999;

    animation: fadeIn .3s ease;
}

.modal-card {
    background: var(--surface);
    padding: 36px 32px;
    border-radius: 18px;
    text-align: center;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--accent);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-icon {
    font-size: 44px;
    margin-bottom: 12px;
}

.modal-card h3 {
    color: var(--primary);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}

.modal-card p {
    color: #666;
    font-size: 14px;
    margin-bottom: 24px;
}

/* Loader Bar Progress */
.modal-overlay{
    position: fixed;
    inset: 0;
    background: rgba(27,27,27,.65);
    backdrop-filter: blur(5px);

    display:flex;
    justify-content:center;
    align-items:center;

    z-index:9999;

    animation: fadeIn .3s ease;
}

.modal-card{
    background: var(--surface);
    width:90%;
    max-width:380px;

    padding:35px;
    border-radius:18px;
    text-align:center;

    border:1px solid var(--accent);
    box-shadow:0 20px 40px rgba(0,0,0,.15);

    animation: popup .35s ease;
}

.modal-icon{
    font-size:50px;
    margin-bottom:15px;
}

.modal-card h3{
    margin-bottom:8px;
    color:var(--primary);
}

.modal-card p{
    color:#666;
    margin-bottom:22px;
}

.loader-bar{
    width:100%;
    height:6px;
    background:#ece8e2;
    border-radius:20px;
    overflow:hidden;
}

.loader-progress{
    width:0%;
    height:100%;
    background:var(--secondary);
    animation:loading 3.5s linear forwards;
}

@keyframes loading{
    from{width:0%;}
    to{width:100%;}
}

@keyframes popup{
    from{
        opacity:0;
        transform:scale(.85);
    }
    to{
        opacity:1;
        transform:scale(1);
    }
}

@keyframes fadeIn{
    from{opacity:0;}
    to{opacity:1;}
}

@media (max-width: 480px) {
    .container .card.login-card {
        padding: 28px 20px;
    }
}

.otp-lockout-notice {
    margin: 14px 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(220, 53, 69, .08);
    border: 1px solid rgba(220, 53, 69, .22);
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
}
.otp-attempt-hint {
    margin: 8px 0 14px;
    font-size: 12px;
    opacity: .75;
}


/* Separate authentication portals */
.portal-switch {
    margin-top: 16px;
    font-size: 0.88rem;
}
.portal-switch a {
    font-weight: 600;
}


/* Separate authentication portals */
.login-card-admin h2 { letter-spacing: .01em; }
.login-card-staff h2 { letter-spacing: .01em; }
.auth-portal-admin .login-card,
.auth-portal-staff .login-card {
    border-top: 4px solid currentColor;
}
.auth-portal-admin .login-card { color: inherit; }
.auth-portal-staff .login-card { color: inherit; }

/* v27 OTP/account attempt reminders */
.login-attempt-reminder {
    margin: 0 0 14px;
    padding: 9px 11px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.45;
    background: rgba(27, 27, 27, 0.05);
    color: #555;
}
.login-attempt-reminder i { margin-right: 5px; }
.otp-attempt-hint { line-height: 1.45; }
.otp-attempt-hint strong { font-weight: 700; }

/* OTP verification error/success messages */
.form-alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
}

.form-alert.error {
    background-color: rgba(217, 83, 79, 0.10);
    color: #C62828;
    border: 1px solid #D9534F;
}

.form-alert.success {
    background-color: rgba(94, 139, 90, 0.10);
    color: #3F6F3B;
    border: 1px solid #5E8B5A;
}
