@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
    --bg-deep: #0a0a1a;
    --bg-card: rgba(16, 16, 36, 0.85);
    --bg-input: rgba(255, 255, 255, 0.05);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(99, 102, 241, 0.5);
    --text-primary: #f0f0f5;
    --text-secondary: #8888a0;
    --text-muted: #55556a;
    --accent: #6366f1;
    --accent-dim: rgba(99, 102, 241, 0.15);
    --accent-glow: rgba(99, 102, 241, 0.4);
    --gradient-btn: linear-gradient(135deg, #f59e0b 0%, #f97316 40%, #ef4444 100%);
    --gradient-btn-hover: linear-gradient(135deg, #fbbf24 0%, #fb923c 40%, #f87171 100%);
    --success-green: #22c55e;
    --error-red: #ef4444;
    --radius: 12px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ============================================================
   BACKGROUND GLOWS
   ============================================================ */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
}

.bg-glow--1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    top: -200px;
    right: -150px;
}

.bg-glow--2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.1) 0%, transparent 70%);
    bottom: -200px;
    left: -150px;
}

/* ============================================================
   BACK BUTTON
   ============================================================ */
.back-btn {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.back-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(-2px);
}

.back-btn i {
    font-size: 1.1rem;
}

/* ============================================================
   MAIN LOGIN PAGE
   ============================================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    padding: 2rem;
}

/* ============================================================
   ROBOT WRAPPER (behind card)
   ============================================================ */
.robot-wrapper {
    position: absolute;
    /* Position relative to the container center */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -65%); /* Move slightly up to peek from top/behind */
    z-index: 1; /* Behind card (z-index 2) but above bg (z-index 0) */
    opacity: 0.6; /* Increased opacity */
    pointer-events: auto; /* Enable interaction again */
    transition: all 0.5s ease-out;
}

.robot-wrapper .geo-bot-svg {
    width: 380px; /* Slightly larger */
    height: 380px;
    overflow: visible;
    filter: drop-shadow(0 0 40px rgba(99, 102, 241, 0.2));
}

/* Hover effect: Robot peeks up slightly */
.login-page:hover .robot-wrapper {
    transform: translate(-50%, -70%);
    opacity: 0.8;
}

/* ============================================================
   LOGIN CARD
   ============================================================ */
.login-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 40px 36px 32px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.03),
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 80px rgba(99, 102, 241, 0.05);
}

/* Logo */
.login-card__logo {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.login-card__logo-svg {
    width: 52px;
    height: 52px;
    color: var(--text-primary);
    filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.3));
}

/* Title */
.login-card__title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px; /* Reduced margin */
    letter-spacing: -0.02em;
}

.login-card__subtitle {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-card__title span {
    background: linear-gradient(135deg, #e0e7ff 0%, #6366f1 50%, #a78bfa 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientMove 3s linear infinite;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ============================================================
   INPUT GROUPS
   ============================================================ */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    height: 48px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 0 44px 0 16px;
    font-size: 0.95rem;
    font-family: var(--font);
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-wrapper input:focus {
    border-color: var(--border-focus);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.15rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.input-wrapper input:focus ~ .input-icon {
    color: var(--accent);
}

/* ============================================================
   TERMS CHECKBOX
   ============================================================ */
.terms-row {
    margin-bottom: 24px;
    margin-top: 4px;
}

.terms-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    position: relative;
    padding-left: 30px;
}

.terms-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    top: 1px;
    width: 18px;
    height: 18px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.terms-label:hover .checkmark {
    border-color: rgba(255, 255, 255, 0.2);
}

.terms-label input:checked ~ .checkmark {
    background: var(--accent);
    border-color: var(--accent);
}

.checkmark::after {
    content: '';
    position: absolute;
    display: none;
    left: 5.5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.terms-label input:checked ~ .checkmark::after {
    display: block;
}

.terms-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.terms-link:hover {
    color: #818cf8;
    text-decoration: underline;
}

/* ============================================================
   LOGIN BUTTON
   ============================================================ */
/* LOGIN BUTTON */
.login-btn {
    width: 100%;
    height: 50px;
    background: var(--gradient-btn);
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font);
    color: #ffffff; /* Default text color */
    cursor: pointer;
    letter-spacing: 0.08em;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

/* Metallic/Silver Hover Effect */
.login-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 50%, #cbd5e1 100%); /* Silver/White Metal */
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 10px;
    z-index: -1; /* Behind text */
}

.login-btn:not(:disabled):hover::before {
    opacity: 1;
}

.login-btn:not(:disabled):hover {
    transform: translateY(-1px);
    color: #0f172a; /* Dark text on bright background */
    box-shadow: 
        0 0 20px rgba(255, 255, 255, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.1);
    text-shadow: none;
}

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

.login-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #334155;
    color: #94a3b8;
}

/* ============================================================
   LOGIN CARD FOOTER
   ============================================================ */
.login-card__footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

.footer-link {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* ============================================================
   TERMS MODAL
   ============================================================ */
.terms-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 2rem;
}

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

.terms-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.terms-modal__content {
    position: relative;
    width: 100%;
    max-width: 620px;
    max-height: 80vh;
    background: #111128;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s ease;
}

.terms-modal.active .terms-modal__content {
    transform: translateY(0) scale(1);
}

.terms-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.terms-modal__header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.terms-modal__close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.3rem;
    transition: all 0.2s ease;
}

.terms-modal__close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.terms-modal__body {
    padding: 24px;
    overflow-y: auto;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.terms-modal__body::-webkit-scrollbar {
    width: 6px;
}

.terms-modal__body::-webkit-scrollbar-track {
    background: transparent;
}

.terms-modal__body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.terms-subtitle {
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
}

.terms-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.terms-modal__body h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 24px 0 8px;
}

.terms-modal__body p {
    margin-bottom: 12px;
}

.terms-modal__body ul {
    margin: 8px 0 12px 20px;
}

.terms-modal__body li {
    margin-bottom: 6px;
}

/* ============================================================
   ALERT SYSTEM
   ============================================================ */
.alert-box {
    position: fixed;
    top: 20px;
    right: 20px;
    width: auto;
    max-width: 400px;
    background: #1a1a2e;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 1rem 1.5rem;
    z-index: 2000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transform: translateX(calc(100% + 20px));
    transition: transform 0.5s ease-in-out;
    overflow: hidden;
}

.alert-box.show {
    transform: translateX(0);
}

.alert {
    display: flex;
    align-items: center;
    height: 100%;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

.alert::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    animation: progress 5s linear forwards;
}

@keyframes progress {
    100% { width: 0; }
}

.alert.sucess::after { background: var(--success-green); }
.alert.sucess i { color: var(--success-green); }

.alert.error::after { background: var(--error-red); }
.alert.error i { color: var(--error-red); }

.alert i {
    font-size: 1.4rem;
    margin-right: 10px;
}

/* ============================================================
   ROBOT STATES (Interactive)
   ============================================================ */
.geo-bot-svg .bot-pupil,
.geo-bot-svg .bot-mouth,
.geo-bot-svg .bot-hand,
.geo-bot-svg .eyelid {
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.geo-bot-svg .bot-pupil {
    transition: transform 0.1s ease-out;
}

/* Happy State */
.geo-bot-svg.happy .bot-mouth {
    transform-origin: center;
    transform: scaleY(1.8) translateY(-2px);
    stroke: #fbbf24;
    filter: drop-shadow(0 0 5px rgba(251, 191, 36, 0.5));
}

.geo-bot-svg.happy .bot-eye circle:first-child {
    fill: rgba(255, 255, 240, 0.95);
}

/* Shy State */
.geo-bot-svg.shy .hand-left {
    transform: translate(40px, -90px);
}

.geo-bot-svg.shy .hand-right {
    transform: translate(-40px, -90px);
}

.geo-bot-svg.shy .eyelid {
    stroke: #1a1a2e;
    stroke-width: 2px;
    transform: translateY(5px);
}

.geo-bot-svg .bot-hand {
    transform: translate(0, 0);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .back-btn {
        top: 16px;
        left: 16px;
        padding: 6px 12px;
        font-size: 0.82rem;
    }

    .back-btn span {
        display: none;
    }

    .login-page {
        padding: 1.5rem 1rem;
    }

    .login-card {
        padding: 32px 24px 24px;
        border-radius: 14px;
    }

    .login-card__title {
        font-size: 1.3rem;
    }

    .robot-wrapper .geo-bot-svg {
        width: 240px;
        height: 240px;
    }

    .terms-modal {
        padding: 1rem;
    }

    .terms-modal__content {
        max-height: 85vh;
    }

    .terms-modal__header h2 {
        font-size: 0.95rem;
    }
}

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

    .robot-wrapper {
        display: none;
    }
}