/* ============================================
   MyChat auth screens — Telegram-style dark theme
   Shared by signin.php, signup.php, forgot_pass.php, create_password.php
   plus the public profile page (profile.php) and QR scanner (scan_qr.php).
   Design tokens mirror css/telegram.css (#0e1621, #17212b, #242f3d, #2AABEE)
   ============================================ */
:root{
    --auth-bg:#0e1621;
    --auth-surface:#17212b;
    --auth-input:#242f3d;
    --auth-border:#2b3a4a;
    --auth-blue:#2AABEE;
    --auth-blue-hover:#2496d3;
    --auth-green:#00d94b;
    --auth-red:#f0616d;
    --auth-text:#f5f5f5;
    --auth-muted:#6f7b8c;
}

html,body{height:100%;}

body{
    margin:0;
    background:var(--auth-bg);
    background-image:
        radial-gradient(900px 520px at 85% -10%, rgba(42,171,238,.14), transparent 60%),
        radial-gradient(700px 420px at -10% 110%, rgba(0,217,75,.06), transparent 60%);
    background-attachment:fixed;
    color:var(--auth-text);
    font-family:'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;
    display:flex;
    min-height:100vh;min-height:100dvh;
    padding:28px 16px;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;overscroll-behavior-y:contain;
    -webkit-tap-highlight-color:transparent;
}

/* ---------- shell + logo ---------- */
.auth-shell{
    width:100%;max-width:420px;
    display:flex;flex-direction:column;align-items:center;
    /* margin:auto centers the shell when the viewport is tall, and degrades
       gracefully to a scrollable top-aligned flow when the form is taller
       than the screen (avoids the classic flexbox "unreachable top" bug). */
    margin:auto;
}

.auth-logo{
    width:74px;height:74px;border-radius:50%;
    background:linear-gradient(135deg,#2AABEE 0%,#168acd 100%);
    color:#fff;font-size:31px;
    display:flex;align-items:center;justify-content:center;
    margin-bottom:20px;
    box-shadow:0 8px 24px rgba(42,171,238,.35), inset 0 1px 0 rgba(255,255,255,.25);
    animation:authFloat 3.2s ease-in-out infinite;
}
@keyframes authFloat{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}

/* ---------- card ---------- */
.auth-card{
    width:100%;
    background:var(--auth-surface);
    border:1px solid var(--auth-border);
    border-radius:14px;
    box-shadow:0 12px 40px rgba(0,0,0,.45);
    padding:34px 32px 30px;
}

.auth-title{
    margin:0 0 6px;
    font-size:24px;font-weight:700;text-align:center;
    color:#fff;letter-spacing:.2px;
}
.auth-sub{
    margin:0 0 26px;
    text-align:center;color:var(--auth-muted);
    font-size:14px;line-height:1.5;
}
.auth-hint{
    color:var(--auth-muted);font-size:12.5px;line-height:1.5;
    margin:0 0 8px;
}

/* ---------- form fields ---------- */
.auth-card .form-group{margin-bottom:18px;}

.auth-label{
    display:block;margin-bottom:7px;
    color:#aeb7c2;font-size:13px;font-weight:600;letter-spacing:.2px;
}

.auth-card .form-control{
    background:var(--auth-input);
    border:1px solid var(--auth-border);
    color:var(--auth-text);
    min-height:46px;
    border-radius:8px;
    box-shadow:none;
    padding:10px 14px;
    transition:border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.auth-card .form-control:focus{
    border-color:var(--auth-blue);
    background:#27374a;
    box-shadow:0 0 0 3px rgba(42,171,238,.18);
}
.auth-card .form-control::placeholder{color:#5e6b7a;}
.auth-card .form-control[disabled]{opacity:.6;cursor:not-allowed;}

/* dark dropdown arrow for selects */
.auth-card select.form-control{
    appearance:none;-webkit-appearance:none;-moz-appearance:none;
    background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23aeb7c2' stroke-width='1.6' stroke-linecap='round'/></svg>");
    background-repeat:no-repeat;
    background-position:right 14px center;
    padding-right:34px;
    cursor:pointer;
}

/* ---------- two-column row (signup) ---------- */
.auth-row{display:flex;gap:14px;}
.auth-row .form-group{flex:1;min-width:0;}

/* ---------- terms ---------- */
.auth-terms{margin-bottom:22px;}
.auth-terms label{
    color:#aeb7c2;font-size:13px;font-weight:400;line-height:1.5;cursor:pointer;
}
.auth-terms a{color:var(--auth-blue);}
.auth-terms a:hover{color:#5fc3f5;text-decoration:underline;}
.auth-terms input[type="checkbox"]{margin-top:1px;accent-color:var(--auth-blue);}

/* ---------- buttons ---------- */
.btn-auth{
    width:100%;
    background:var(--auth-blue);
    color:#fff;border:none;
    min-height:48px;border-radius:8px;
    font-size:15.5px;font-weight:600;letter-spacing:.3px;
    box-shadow:0 4px 14px rgba(42,171,238,.28);
    transition:background .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn-auth:hover,.btn-auth:focus{
    background:var(--auth-blue-hover);color:#fff;
    box-shadow:0 6px 18px rgba(42,171,238,.38);
}
.btn-auth:active{transform:scale(.98);box-shadow:none;}
.btn-auth i{margin-right:7px;}

/* ---------- links ---------- */
.auth-forgot{text-align:right;margin:-8px 0 18px;}
.auth-forgot a{color:var(--auth-blue);font-size:13px;}
.auth-forgot a:hover{color:#5fc3f5;text-decoration:underline;}

.auth-back{text-align:center;margin-top:16px;}
.auth-back a{color:var(--auth-muted);font-size:13.5px;}

/* @-prefixed unique username input (signup) */
.auth-input-wrap{position:relative;display:flex;align-items:center;}
.auth-input-wrap .form-control{padding-left:30px;}
.auth-prefix{position:absolute;left:12px;color:var(--auth-muted);font-size:15px;pointer-events:none;}

/* public group-invite page (join_group.php) */
.join-group-img{width:84px;height:84px;border-radius:22px;object-fit:cover;display:block;margin:0 auto 14px;box-shadow:0 6px 20px rgba(0,0,0,.35);}
.auth-muted{color:var(--auth-muted);font-size:12.5px;margin-top:4px;display:block;}
.join-already{background:rgba(0,217,75,.12);color:#00d94b;font-size:13.5px;border-radius:8px;padding:9px 12px;margin-bottom:12px;text-align:center;}
.join-already i{margin-right:6px;}
.auth-back a:hover{color:var(--auth-blue);text-decoration:none;}

.auth-alt{margin-top:22px;color:#aeb7c2;font-size:14px;text-align:center;}
.auth-alt a{color:var(--auth-blue);font-weight:600;}
.auth-alt a:hover{color:#5fc3f5;text-decoration:underline;}

/* ---------- forgot-password question box ---------- */
.auth-question{
    background:var(--auth-input);
    border:1px solid var(--auth-border);
    border-left:3px solid var(--auth-blue);
    border-radius:8px;
    padding:12px 14px;
    color:#fff;font-weight:600;font-size:14.5px;line-height:1.5;
    margin-bottom:8px;
}

/* ---------- alerts (signin_user/signup_user + inline errors) ---------- */
.auth-card .alert{
    border-radius:8px;border:none;
    padding:11px 14px;font-size:13.5px;line-height:1.5;
    margin:0 0 18px;
}
.auth-card .alert-danger{
    background:#3a1f28;
    border:1px solid rgba(240,97,109,.45);
    color:var(--auth-red);
}
.auth-card .alert-danger strong{font-weight:600;}

/* ---------- responsive ---------- */
@media (max-width:480px){
    body{padding:18px 12px;padding-top:calc(26px + env(safe-area-inset-top));}
    .auth-logo{width:62px;height:62px;font-size:26px;margin-bottom:16px;}
    .auth-card{padding:26px 20px 24px;border-radius:12px;}
    .auth-title{font-size:21px;}
    .auth-card .form-control{min-height:44px;}
    .btn-auth{min-height:46px;}
    /* two selects would be cramped on phones — stack them */
    .auth-row{flex-direction:column;gap:0;}
}

/* ---------- public profile page (profile.php) ---------- */
.auth-avatar-big{width:96px;height:96px;border-radius:50%;object-fit:cover;display:block;margin:0 auto 14px;border:3px solid #2b3a4a;box-shadow:0 6px 18px rgba(0,0,0,.4);}
.auth-name{color:#fff;font-size:22px;font-weight:700;text-align:center;margin:0 0 2px;}
.auth-handle{color:#2AABEE;font-weight:700;font-size:16px;text-align:center;margin:0 0 8px;}
.auth-status{text-align:center;color:#6f7b8c;font-size:13.5px;margin:0 0 16px;}
.auth-status .chat-dot{display:inline-block;width:8px;height:8px;border-radius:50%;vertical-align:middle;margin-right:5px;}
.auth-status .chat-dot.online{background:#00d94b;box-shadow:0 0 6px rgba(0,217,75,.6);}
.auth-status .chat-dot.offline{background:#5e6b7a;}
.auth-profile-bio{background:#242f3d;border:1px solid #2b3a4a;border-radius:8px;padding:12px 14px;color:#aeb7c2;font-size:14px;line-height:1.55;margin:0 0 14px;text-align:center;}
.auth-profile-meta{display:flex;justify-content:center;gap:18px;color:#aeb7c2;font-size:13px;margin:0 0 20px;flex-wrap:wrap;}
.auth-profile-meta span i{margin-right:5px;color:#2AABEE;}
.auth-profile-actions{display:flex;gap:10px;}
.auth-profile-actions .btn-auth{flex:1;margin-top:0;}

/* ---------- QR scanner page (scan_qr.php) ---------- */
.scanner-box{position:relative;margin-bottom:16px;}
.scanner-video{width:100%;border-radius:12px;background:#000;border:1px solid #2b3a4a;display:block;aspect-ratio:1/1;object-fit:cover;}
.scanner-frame{position:absolute;inset:0;pointer-events:none;border-radius:12px;box-shadow:0 0 0 9999px rgba(14,22,33,.55);}
.scanner-line{position:absolute;left:10%;right:10%;top:50%;height:2px;background:rgba(42,171,238,.85);box-shadow:0 0 12px rgba(42,171,238,.9);animation:scanMove 2.2s ease-in-out infinite;}
@keyframes scanMove{0%,100%{transform:translateY(-78px)}50%{transform:translateY(78px)}}
.scanner-hint{color:#6f7b8c;font-size:13px;text-align:center;margin:0 0 16px;line-height:1.5;}
.auth-inline-row{display:flex;gap:10px;}
.auth-inline-row .form-control{flex:1;min-width:0;}
.auth-inline-row .btn-auth{width:auto;min-width:92px;flex-shrink:0;}

/* live username availability indicator (signup) */
.handle-check{
    display:flex;align-items:center;gap:6px;min-height:18px;margin-top:6px;
    font-size:12.5px;line-height:1.35;
}
.handle-check.ok{color:#00d94b;}
.handle-check.taken{color:#f0616d;}
.handle-check.checking{color:var(--auth-muted,#8a94a3);}
