/* styles.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root{
    --brand:#376998;
    --brand-dark:#2c5282;
    --text-600:#2c5282;
    --text-500:#4a5568;
    --muted:#718096;
    --border:#e2e8f0;
    --error:#f56565;
}

/* Base */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--brand);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===================== Header ===================== */
.header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Small corner brand logo */
.brand-corner{
    position: absolute;
    /* requested padding on top & left */
    top: 12px;
    left: 12px;
    height: 36px;
    width: auto;
    z-index: 101;
    pointer-events: none;
    user-select: none;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.header-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-600);
}

.header-nav {
    display: flex;
    gap: 2rem;
}

.header-nav a {
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.header-nav a:hover {
    color: var(--brand);
}

/* ===== Login page header behavior ===== */
body.login-page .header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}


body.login-page .header-nav,
body.login-page .header-actions {
    display: none !important;
}

/* Center the "Agency Management" title on login page */
body.login-page .header-content{
    justify-content: flex-start;
    padding: 1rem 2rem;
}
body.login-page .header-logo{
    pointer-events: none; /* don't navigate from login */
}

/* Login-only strip */
body.login-page #loginHeaderContent {
    display: block !important;
    color: var(--text-500);
    font-weight: 600;
}

/* ===================== Login Layout ===================== */
.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--brand);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-600);
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-600);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--muted);
    font-size: 0.95rem;
}

.login-alert {
    background: #fff4f4;
    border: 1px solid #f2bcbc;
    border-radius: 8px;
    color: #b42318;
    font-size: 0.9rem;
    padding: 10px 12px;
    margin-bottom: 1rem;
    text-align: left;
}

/* ===================== Form ===================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-600);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* LEFT icon (user/lock) perfectly centered */
.input-wrapper > i {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF;
    font-size: 0.95rem;
    z-index: 2;
    pointer-events: none;
    line-height: 1;
}

/* Input box with room for eye button on the right */
.input-wrapper input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: white;
    padding-right: 3rem;     /* space for toggle button */
    min-height: 44px;        /* consistent height */
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(55, 105, 152, 0.1);
}

.input-wrapper input::placeholder {
    color: #a0aec0;
}

/* Show/Hide password button, perfectly centered */
.toggle-password {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    height: 28px;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    z-index: 2;
    line-height: 1;
}

.toggle-password i{
    font-size: 0.95rem;
    line-height: 1;
}

.toggle-password:hover {
    color: #5a67d8;
}

/* Inline input errors (validation) */
.input-wrapper input.error {
    border-color: var(--error) !important;
    box-shadow: 0 0 0 3px rgba(245, 101, 101, 0.1) !important;
}
.input-wrapper input.error:focus {
    box-shadow: 0 0 0 3px rgba(245, 101, 101, 0.2) !important;
}

/* Inline auth/validation message right below the field */
.field-error {
    color: var(--error);
    font-size: 0.80rem;
    margin-top: 0.4rem;
    font-weight: 600;
}

/* ===================== Form Options ===================== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.875rem;
    color: #4a5568;
}

.checkbox-container input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    margin-right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.checkbox-container input:checked + .checkmark {
    background: var(--brand);
    border-color: var(--brand);
}

.checkbox-container input:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

.forgot-password {
    color: var(--brand);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

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

/* ===================== Buttons ===================== */
.login-btn {
    width: 100%;
    background: var(--brand);
    color: white;
    border: none;
    padding: 0.875rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
    position: relative; /* needed to center spinner */
    overflow: hidden;
}

.login-btn:hover {
    background: var(--brand-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(55, 105, 152, 0.3);
}

.login-btn:active {
    transform: translateY(0);
}

/* Spinner fix: perfectly centered over the button text */
.login-btn .loading-spinner {
    display: none !important;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.1rem;
    line-height: 1;
}

.login-btn.loading .loading-spinner { display: inline-block !important; }
.login-btn.loading .btn-text { opacity: 0 !important; }

/* ===================== Divider & Google Button ===================== */
.divider {
    position: relative;
    text-align: center;
    margin: 1.5rem 0;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.divider span {
    background: white;
    color: var(--muted);
    padding: 0 1rem;
    font-size: 0.875rem;
}

/* Google Button */
.google-btn {
    width: 100%;
    background: white;
    border: 2px solid var(--border);
    padding: 0.875rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    color: #374151;
}

.google-btn:hover {
    border-color: #d1d5db;
    background: #f9fafb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.google-btn img {
    width: 20px;
    height: 20px;
}

/* ===================== Login Footer ===================== */
.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.login-footer p {
    color: var(--muted);
    font-size: 0.875rem;
}

.signup-link {
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
}

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

/* ===================== Global Footer ===================== */
.footer {
    background: #2d3748;
    color: white;
    padding: 2rem 0 1rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: white;
}

.footer-section p,
.footer-section a {
    color: #a0aec0;
    text-decoration: none;
    line-height: 1.6;
    font-size: 0.875rem;
}

.footer-section a:hover {
    color: white;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-bottom {
    border-top: 1px solid #4a5568;
    margin-top: 2rem;
    padding-top: 1rem;
    text-align: center;
    color: #a0aec0;
    font-size: 0.875rem;
}

/* ===================== Responsive ===================== */
@media (max-width: 768px) {
    .login-container { padding: 1rem; }
    .login-card { padding: 2rem 1.5rem; }
    .header { padding: 1rem; }
    .header-nav { display: none; }

    .form-options {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .login-card { padding: 1.5rem; }
    .logo h1 { font-size: 1.75rem; }
    .login-header h2 { font-size: 1.25rem; }
}

/* ===== Login Page Specific Styles ===== */
body.login-page {
    background: #376998;
}

/* Login page header - simplified */
body.login-page .header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

body.login-page .header-nav,
body.login-page .header-actions {
    display: none !important;
}

body.login-page .header-content {
    justify-content: center;
}

body.login-page .header-logo {
    pointer-events: none;
}

/* Login info box */
.login-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f0f9ff;
    border-radius: 8px;
    border-left: 3px solid #3b82f6;
}

.login-info p {
    color: #1e40af;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.login-info i {
    color: #3b82f6;
}

/* Support link */
.support-link {
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.support-link:hover {
    color: var(--brand-dark);
    text-decoration: underline;
}

/* Footer on login page */
body.login-page .footer {
    background: rgba(45, 55, 72, 0.95);
    backdrop-filter: blur(10px);
}
