:root {
    --ib-blue: #003C82;
    --ib-blue-light: #1565C0;
    --ib-blue-glow: rgba(21, 101, 192, 0.4);
    --ib-cyan: #42A5F5;
    --orange: #FB8C00;
    --orange-glow: rgba(251, 140, 0, 0.45);
    --bg-dark: #141820;
    --bg-card: #1a2130;
    --bg-input: #1e2535;
    --border: rgba(255,255,255,0.10);
    --border-focus: rgba(66, 165, 245, 0.55);
    --text: #eef0f4;
    --text-muted: rgba(238,240,244,0.45);
    --err: #f44336;
    --ok: #66BB6A;
    --transition: 0.28s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg-dark);
    color: var(--text);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    z-index: 1;
}

/* ══════════════════════════════════════
   WAVE BACKGROUND
══════════════════════════════════════ */
#wave-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ══════════════════════════════════════
   LOADING
══════════════════════════════════════ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.iscep-logo-loader {
    animation: loaderPop 0.6s cubic-bezier(0.34,1.56,0.64,1) forwards,
               loaderPulse 1.8s 0.6s ease-in-out infinite;
}

@keyframes loaderPop {
    from { transform: scale(0.4); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

@keyframes loaderPulse {
    0%, 100% { transform: scale(1);    filter: brightness(1); }
    50%       { transform: scale(1.08); filter: brightness(1.2); }
}

.loading-bar {
    width: 120px;
    height: 3px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--ib-blue-light), var(--ib-cyan));
    border-radius: 2px;
    animation: loadFill 1.3s 0.2s ease-out forwards;
}

@keyframes loadFill {
    to { width: 100%; }
}

/* ══════════════════════════════════════
   APP CONTAINER
══════════════════════════════════════ */
.app-container {
    width: 100%;
    max-width: 430px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    background: transparent;
}

.app-container.show {
    opacity: 1;
    transform: translateY(0);
}

/* ══════════════════════════════════════
   SCREENS
══════════════════════════════════════ */
.screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    padding: 0 24px 32px;
}

.screen.active-screen {
    display: flex;
    animation: screenSlide 0.38s cubic-bezier(0.25,0.46,0.45,0.94) forwards;
}

.screen.slide-left {
    animation: screenSlideLeft 0.35s cubic-bezier(0.25,0.46,0.45,0.94) forwards;
}

@keyframes screenSlide {
    from { opacity: 0; transform: translateX(32px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes screenSlideLeft {
    from { opacity: 0; transform: translateX(-32px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ══════════════════════════════════════
   HEADER
══════════════════════════════════════ */
.screen-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 28px 0 20px;
    position: relative;
    animation: fadeDown 0.5s 0.1s ease both;
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.screen-header.with-back { justify-content: center; }

.back-btn {
    position: absolute;
    left: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    border-radius: 8px;
    transition: color var(--transition), background var(--transition), transform 0.2s;
}

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

.back-btn:active { transform: scale(0.92); }

.header-title {
    font-size: 18px;
    font-weight: 700;
    font-style: italic;
    color: var(--text);
    letter-spacing: 0.2px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-name {
    font-size: 20px;
    font-weight: 800;
    font-style: italic;
    color: var(--text);
    letter-spacing: -0.3px;
}

/* ══════════════════════════════════════
   AVATAR
══════════════════════════════════════ */
.user-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 8px 0 28px;
    animation: avatarIn 0.6s 0.15s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes avatarIn {
    from { opacity: 0; transform: scale(0.7) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.avatar-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    animation: avatarFloat 4s ease-in-out infinite;
}

@keyframes avatarFloat {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-5px); }
}

.user-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.user-name.updating {
    opacity: 0.3;
    transform: scale(0.95);
}

.user-name.revealed {
    animation: nameReveal 0.5s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes nameReveal {
    from { opacity: 0; transform: translateY(6px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.user-type {
    font-size: 13px;
    color: var(--text-muted);
}

/* ══════════════════════════════════════
   OTP ICON
══════════════════════════════════════ */
.otp-icon-wrap {
    display: flex;
    justify-content: center;
    margin: 20px 0 20px;
    animation: avatarIn 0.6s 0.1s cubic-bezier(0.34,1.56,0.64,1) both;
}

.otp-icon-ring {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 3px solid var(--ib-blue-light);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 24px var(--ib-blue-glow);
    animation: ringPulseBlue 2.5s ease-in-out infinite;
}

@keyframes ringPulseBlue {
    0%, 100% { box-shadow: 0 0 20px var(--ib-blue-glow); }
    50%       { box-shadow: 0 0 40px var(--ib-blue-glow), 0 0 0 8px rgba(21,101,192,0.08); }
}

.otp-icon-ring.orange-ring {
    border-color: var(--orange);
    box-shadow: 0 0 28px var(--orange-glow);
    animation: ringPulseOrange 2s ease-in-out infinite;
}

@keyframes ringPulseOrange {
    0%, 100% { box-shadow: 0 0 20px var(--orange-glow); transform: scale(1); }
    50%       { box-shadow: 0 0 50px var(--orange-glow), 0 0 0 10px rgba(251,140,0,0.07); transform: scale(1.04); }
}

.step-text-block {
    text-align: center;
    margin-bottom: 28px;
    animation: fadeUp 0.5s 0.2s ease both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.step-text-block h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.step-text-block p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ══════════════════════════════════════
   FORM
══════════════════════════════════════ */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: relative;
    animation: fadeUp 0.45s ease both;
}

/* stagger each input-group */
.auth-form .input-group:nth-child(1) { animation-delay: 0.18s; }
.auth-form .input-group:nth-child(2) { animation-delay: 0.26s; }
.auth-form .input-group:nth-child(3) { animation-delay: 0.34s; }

.input-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    text-transform: uppercase;
    transition: color 0.2s;
}

.input-group:focus-within label {
    color: var(--ib-cyan);
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.25s ease,
                box-shadow   0.25s ease,
                background   0.25s ease,
                transform    0.2s ease;
}

.input-group input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(66, 165, 245, 0.12);
    background: #222226;
    transform: translateY(-1px);
}

.input-group input.invalid {
    border-color: var(--err);
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.12);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

.input-group input::placeholder { color: transparent; }

/* Password */
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 48px; }

.eye-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    padding: 4px;
    border-radius: 6px;
    transition: color var(--transition), transform 0.2s;
}

.eye-btn:hover {
    color: var(--text);
    transform: translateY(-50%) scale(1.15);
}

.slash-line { opacity: 0; transition: opacity 0.2s; }
.pass-hidden .slash-line { opacity: 1; }

.field-error {
    color: var(--err);
    font-size: 12px;
    min-height: 16px;
    font-weight: 500;
    animation: fadeUp 0.3s ease;
}

/* ══════════════════════════════════════
   FORM LINKS
══════════════════════════════════════ */
.form-links {
    display: flex;
    justify-content: space-between;
    margin-top: -4px;
    animation: fadeUp 0.45s 0.35s ease both;
}

.text-link {
    font-size: 11px;
    font-weight: 600;
    color: var(--ib-cyan);
    text-decoration: none;
    letter-spacing: 0.3px;
    transition: color var(--transition), letter-spacing 0.2s;
    position: relative;
}

.text-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--ib-cyan);
    transition: width 0.25s ease;
}

.text-link:hover {
    color: #fff;
    letter-spacing: 0.5px;
}

.text-link:hover::after { width: 100%; }

/* ══════════════════════════════════════
   MAIN BUTTON
══════════════════════════════════════ */
.main-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #334155, #1e293b);
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: auto;
    position: relative;
    overflow: hidden;
    animation: fadeUp 0.45s 0.4s ease both;
}

/* Ripple */
.main-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.15) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.main-btn:active::after { opacity: 1; }

.main-btn.active {
    background: linear-gradient(135deg, var(--ib-blue-light), var(--ib-blue));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 20px var(--ib-blue-glow);
    animation: fadeUp 0.45s 0.4s ease both,
               btnGlow 3s 1s ease-in-out infinite;
}

@keyframes btnGlow {
    0%, 100% { box-shadow: 0 4px 20px var(--ib-blue-glow); }
    50%       { box-shadow: 0 8px 32px var(--ib-blue-glow), 0 0 0 4px rgba(21,101,192,0.1); }
}

.main-btn.active:hover {
    background: linear-gradient(135deg, #0077eb, #005fc0);
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 10px 32px var(--ib-blue-glow);
}

.main-btn.active:active {
    transform: translateY(0) scale(0.99);
}

.main-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* TC readonly display */
.readonly-field {
    opacity: 0.55;
    cursor: default;
    pointer-events: none;
    letter-spacing: 1.5px;
    font-size: 15px;
    color: var(--text) !important;
}

/* ══════════════════════════════════════
   RESEND
══════════════════════════════════════ */
.resend-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: -4px;
    animation: fadeUp 0.45s 0.3s ease both;
}

.resend-btn {
    background: none;
    border: none;
    color: var(--ib-cyan);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color var(--transition), transform 0.2s;
}

.resend-btn:hover {
    color: #fff;
    transform: translateX(2px);
}

.resend-btn:disabled { color: var(--text-muted); cursor: not-allowed; transform: none; }

.countdown {
    font-size: 13px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    transition: color 0.3s;
}

.countdown.urgent { color: var(--orange); animation: countdownBlink 1s ease-in-out infinite; }

@keyframes countdownBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

/* ══════════════════════════════════════
   DOTS LOADING (Sorgulanıyor)
══════════════════════════════════════ */
.loading-dots::after {
    content: '';
    animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
}

/* ══════════════════════════════════════
   CONFETTI
══════════════════════════════════════ */
#confetti-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10001;
}

/* ══════════════════════════════════════
   SUCCESS CARD
══════════════════════════════════════ */
.success-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 32px 16px;
    animation: avatarIn 0.6s cubic-bezier(0.34,1.56,0.64,1) both;
}

.success-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.success-card p {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.6;
}

.success-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1b5e20, #2e7d32);
    border: 3px solid #43a047;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    color: #fff;
    box-shadow: 0 0 32px rgba(67,160,71,0.35);
    animation: avatarIn 0.6s 0.1s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* ══════════════════════════════════════
   UTILITY
══════════════════════════════════════ */
.hidden { display: none !important; }

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 430px) {
    .screen { padding: 0 18px 28px; }
}