@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

/* ── Theme Variables ── */
:root {
    --primary: #00BFFF;
    --primary-dark: #0077b6;
    --primary-rgb: 0,191,255;
    --accent: #6C63FF;
    --accent-rgb: 108,99,255;
    --bg-body: #0f0c29;
    --bg-card: rgba(255,255,255,0.95);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --input-bg: #f1f5f9;
    --glass-border: rgba(255,255,255,0.18);
    --shadow-card: 0 8px 32px 0 rgba(0,0,0,0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
    text-decoration: none;
    list-style: none;
}

/* ── Animated Gradient Background ── */
body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(-45deg, #0f0c29, #302b63, #24243e, #0077b6, #00BFFF);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    overflow: hidden;
}

@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ── Floating Background Icons ── */
.bg-icons {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-icons i {
    position: absolute;
    color: rgba(255,255,255,0.07);
    animation: floatIcon linear infinite;
    filter: drop-shadow(0 0 6px rgba(var(--primary-rgb),0.15));
}

.bg-icons i:nth-child(1)  { left:  3%; font-size: 26px; animation-duration: 20s; animation-delay: 0s;   top: -40px; }
.bg-icons i:nth-child(2)  { left: 12%; font-size: 34px; animation-duration: 24s; animation-delay: 2s;   top: -40px; }
.bg-icons i:nth-child(3)  { left: 22%; font-size: 22px; animation-duration: 18s; animation-delay: 4s;   top: -40px; }
.bg-icons i:nth-child(4)  { left: 32%; font-size: 40px; animation-duration: 26s; animation-delay: 1s;   top: -40px; }
.bg-icons i:nth-child(5)  { left: 42%; font-size: 24px; animation-duration: 22s; animation-delay: 3s;   top: -40px; }
.bg-icons i:nth-child(6)  { left: 53%; font-size: 30px; animation-duration: 21s; animation-delay: 5s;   top: -40px; }
.bg-icons i:nth-child(7)  { left: 63%; font-size: 36px; animation-duration: 25s; animation-delay: 0.5s; top: -40px; }
.bg-icons i:nth-child(8)  { left: 73%; font-size: 28px; animation-duration: 19s; animation-delay: 3.5s; top: -40px; }
.bg-icons i:nth-child(9)  { left: 83%; font-size: 32px; animation-duration: 23s; animation-delay: 1.5s; top: -40px; }
.bg-icons i:nth-child(10) { left: 93%; font-size: 24px; animation-duration: 27s; animation-delay: 4.5s; top: -40px; }
.bg-icons i:nth-child(11) { left:  8%; font-size: 28px; animation-duration: 22s; animation-delay: 6s;   top: -40px; }
.bg-icons i:nth-child(12) { left: 48%; font-size: 32px; animation-duration: 24s; animation-delay: 7s;   top: -40px; }
.bg-icons i:nth-child(13) { left: 58%; font-size: 20px; animation-duration: 19s; animation-delay: 8s;   top: -40px; }
.bg-icons i:nth-child(14) { left: 78%; font-size: 26px; animation-duration: 21s; animation-delay: 2.5s; top: -40px; }
.bg-icons i:nth-child(15) { left: 18%; font-size: 38px; animation-duration: 28s; animation-delay: 5.5s; top: -40px; }

@keyframes floatIcon {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg) scale(1);
        opacity: 0;
    }
    5% { opacity: 1; }
    50% {
        transform: translateY(55vh) translateX(30px) rotate(180deg) scale(0.85);
    }
    95% { opacity: 1; }
    100% {
        transform: translateY(115vh) translateX(-20px) rotate(360deg) scale(0.5);
        opacity: 0;
    }
}

/* ── Container (Glassmorphism) ── */
.container {
    position: relative;
    width: 900px;
    min-height: 560px;
    background: var(--bg-card);
    margin: 20px;
    border-radius: 24px;
    box-shadow: var(--shadow-card), 0 0 80px rgba(var(--primary-rgb),0.08);
    overflow: hidden;
    z-index: 1;
    border: 1px solid var(--glass-border);
    animation: containerFadeIn 0.9s cubic-bezier(0.16,1,0.3,1);
}

@keyframes containerFadeIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

    .container h1 {
        font-size: 32px;
        margin: -6px 0 2px;
        font-weight: 700;
        letter-spacing: -0.5px;
    }

    .container p {
        font-size: 14px;
        margin: 8px 0 12px;
    }

/* ── Gradient Heading ── */
.form-box h1 {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleSlideDown 0.7s ease-out 0.3s both;
}

@keyframes titleSlideDown {
    from { opacity: 0; transform: translateY(-18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.form-box .subtitle {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
    animation: titleSlideDown 0.7s ease-out 0.45s both;
}

/* ── Logo ── */
.form-box img {
    animation: logoFloat 4s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(var(--primary-rgb),0.25));
    border-radius: 20px;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

/* ── Form ── */
form { width: 100%; }

.form-box {
    position: absolute;
    right: 0;
    width: 50%;
    height: 100%;
    background: transparent;
    display: flex;
    align-items: center;
    color: var(--text-primary);
    text-align: center;
    padding: 28px 34px;
    z-index: 1;
    transition: .6s ease-in-out 1.2s, visibility 0s 1s;
    overflow-y: auto;
}

    .container.active .form-box { right: 50%; }
    .form-box.register { visibility: hidden; }
        .container.active .form-box.register { visibility: visible; }

/* ── Input Fields ── */
.input-box {
    position: relative;
    margin: 18px 0;
    animation: inputSlideUp 0.5s ease-out both;
}
.input-box:nth-child(1) { animation-delay: 0.45s; }
.input-box:nth-child(2) { animation-delay: 0.6s; }
.input-box:nth-child(3) { animation-delay: 0.75s; }

@keyframes inputSlideUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

    .input-box input {
        width: 100%;
        padding: 16px 50px 10px 44px;
        background: var(--input-bg);
        border-radius: 12px;
        border: 2px solid var(--border-color);
        outline: none;
        font-size: 15px;
        color: var(--text-primary);
        font-weight: 500;
        transition: border-color 0.35s, background 0.35s, box-shadow 0.35s;
    }

        .input-box input::placeholder {
            color: transparent;
        }

    /* ── Floating Label ── */
    .floating-label {
        position: absolute;
        left: 44px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 14px;
        color: var(--text-muted);
        pointer-events: none;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        font-weight: 400;
        line-height: 1;
        padding: 0 4px;
        background: transparent;
    }

    /* Float up when focused or filled */
    .input-box input:focus ~ .floating-label,
    .input-box input:not(:placeholder-shown) ~ .floating-label,
    .input-box.filled .floating-label {
        top: -1px;
        left: 12px;
        font-size: 11px;
        font-weight: 600;
        color: var(--primary);
        background: var(--bg-card, #fff);
        padding: 0 6px;
        border-radius: 4px;
    }

    /* ── Animated Bottom Line ── */
    .input-line {
        position: absolute;
        bottom: 0;
        left: 50%;
        width: 0;
        height: 2px;
        background: linear-gradient(90deg, var(--primary), var(--accent));
        border-radius: 0 0 12px 12px;
        transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        pointer-events: none;
    }

    .input-box input:focus ~ .input-line {
        width: 100%;
        left: 0;
    }

    /* ── Focus State ── */
    .input-box input:focus {
        background: #fff;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.12), 0 4px 12px rgba(var(--primary-rgb),0.08);
    }

    /* ── Icon ── */
    .input-box > i:first-child {
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 20px;
        color: var(--text-muted);
        transition: color 0.35s, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1;
    }

    .input-box:focus-within > i:first-child {
        color: var(--primary);
        transform: translateY(-50%) scale(1.15);
    }

    .input-box.filled > i:first-child {
        color: var(--primary-dark);
    }

    /* ── Validation States ── */
    .input-box.valid input {
        border-color: #22c55e;
    }
    .input-box.valid > i:first-child {
        color: #22c55e;
    }
    .input-box.valid input:focus ~ .floating-label,
    .input-box.valid input:not(:placeholder-shown) ~ .floating-label {
        color: #22c55e;
    }
    .input-box.valid .input-line {
        background: #22c55e;
    }

    .input-box.invalid input {
        border-color: #ef4444;
        background: #fef2f2;
    }
    .input-box.invalid > i:first-child {
        color: #ef4444;
    }
    .input-box.invalid input:focus ~ .floating-label,
    .input-box.invalid input:not(:placeholder-shown) ~ .floating-label,
    .input-box.invalid .floating-label {
        color: #ef4444;
    }
    .input-box.invalid .input-line {
        background: #ef4444;
        width: 100%;
        left: 0;
    }

    /* ── Shake animation for invalid ── */
    .input-box.shake {
        animation: shakeInput 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
    }

    @keyframes shakeInput {
        10%, 90% { transform: translateX(-2px); }
        20%, 80% { transform: translateX(4px); }
        30%, 50%, 70% { transform: translateX(-6px); }
        40%, 60% { transform: translateX(6px); }
    }

/* ── Password Strength Meter ── */
.strength-meter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: -8px 0 6px;
    padding: 0 4px;
    height: 0;
    opacity: 0;
    overflow: hidden;
    transition: height 0.35s ease, opacity 0.35s ease, margin 0.35s ease;
}

.strength-meter.visible {
    height: 20px;
    opacity: 1;
    margin: -4px 0 10px;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.strength-bar::after {
    display: none;
}

#strengthBar {
    height: 100%;
    width: 0;
    border-radius: 4px;
    transition: width 0.4s ease, background 0.4s ease;
}

.strength-text {
    font-size: 11px;
    font-weight: 600;
    min-width: 60px;
    text-align: right;
    transition: color 0.3s;
}

/* ── Password Toggle ── */
.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

    .toggle-password:hover {
        color: var(--primary);
    }

/* ── Forgot Link ── */
.forgot-link {
    margin: -4px 0 12px;
    text-align: right;
}

    .forgot-link a {
        font-size: 13px;
        color: var(--text-muted);
        transition: color 0.3s;
        font-weight: 500;
    }

    .forgot-link a:hover {
        color: var(--primary);
    }

/* ── Login Button ── */
.btn {
    width: 100%;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #fff;
    font-weight: 600;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(var(--primary-rgb),0.3);
    letter-spacing: 0.3px;
}

    .btn::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
        transition: left 0.6s;
    }

    .btn:hover::before {
        left: 100%;
    }

    .btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 25px rgba(var(--primary-rgb),0.45),
                    0 2px 10px rgba(var(--accent-rgb),0.2);
    }

    .btn:active {
        transform: translateY(0) scale(0.98);
        box-shadow: 0 2px 10px rgba(var(--primary-rgb),0.3);
    }

/* ── Error Messages ── */
.error-label {
    display: block;
    margin-top: 10px;
    padding: 8px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 13px;
    font-weight: 500;
    animation: shakeError 0.4s ease;
}

.error-label:empty,
.error-label[style*="display:none"] {
    display: none;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(6px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(4px); }
}

/* ── Social / Divider ── */
.login-divider {
    display: flex;
    align-items: center;
    margin: 16px 0 10px;
    gap: 12px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.social-icons {
    display: flex;
    justify-content: center;
}

    .social-icons a {
        display: inline-flex;
        padding: 10px;
        border: 2px solid var(--border-color);
        border-radius: 10px;
        font-size: 24px;
        color: var(--text-primary);
        margin: 0 8px;
        transition: border-color 0.3s, color 0.3s, transform 0.2s;
    }

    .social-icons a:hover {
        border-color: var(--primary);
        color: var(--primary);
        transform: translateY(-2px);
    }

/* ── Toggle Panel ── */
.toggle-box {
    position: absolute;
    width: 100%;
    height: 100%;
}

    .toggle-box::before {
        content: '';
        position: absolute;
        left: -250%;
        width: 300%;
        height: 100%;
        background: linear-gradient(135deg, #302b63, var(--primary-dark), var(--primary));
        border-radius: 150px;
        z-index: 2;
        transition: 1.8s ease-in-out;
    }

        .container.active .toggle-box::before { left: 50%; }

.toggle-panel {
    position: absolute;
    width: 50%;
    height: 100%;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2;
    transition: .6s ease-in-out;
}

    .toggle-panel h1 {
        font-size: 28px;
        font-weight: 700;
        text-shadow: 0 2px 10px rgba(0,0,0,0.15);
    }

    .toggle-panel p {
        opacity: 0.85;
        margin-bottom: 20px;
    }

    .toggle-panel.toggle-left {
        left: 0;
        transition-delay: 1.2s;
    }
        .container.active .toggle-panel.toggle-left {
            left: -50%;
            transition-delay: .6s;
        }

    .toggle-panel.toggle-right {
        right: -50%;
        transition-delay: .6s;
    }
        .container.active .toggle-panel.toggle-right {
            right: 0;
            transition-delay: 1.2s;
        }

    .toggle-panel .btn {
        width: 160px;
        height: 46px;
        background: transparent;
        border: 2px solid rgba(255,255,255,0.7);
        box-shadow: none;
        border-radius: 12px;
        transition: background 0.3s, border-color 0.3s, transform 0.2s;
    }

        .toggle-panel .btn::before { display: none; }

        .toggle-panel .btn:hover {
            background: rgba(255,255,255,0.15);
            border-color: #fff;
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(0,0,0,0.15);
        }

/* ═══════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════ */

/* Tablet */
@media screen and (max-width: 850px) {
    .container {
        width: 96%;
        max-width: 480px;
        min-height: auto;
        height: auto;
        margin: 20px auto;
    }

    .form-box {
        position: relative;
        right: auto;
        width: 100%;
        height: auto;
        padding: 28px 24px;
    }

    .container.active .form-box { right: auto; }

    .form-box.register {
        display: none;
        visibility: hidden;
    }

    .toggle-box { display: none; }
}

/* Mobile */
@media screen and (max-width: 650px) {
    body {
        align-items: flex-start;
    }

    .container {
        width: 100%;
        max-width: none;
        min-height: 100vh;
        height: auto;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        border: none;
        overflow-y: auto;
    }

    .container h1 {
        font-size: 24px;
        margin: 5px 0;
    }

    .form-box {
        position: relative;
        right: auto;
        width: 100%;
        height: auto;
        min-height: 100vh;
        padding: 24px 20px;
        flex-direction: column;
        justify-content: center;
        overflow-y: visible;
    }

    .container.active .form-box {
        right: auto;
        bottom: auto;
    }

    .form-box.register {
        display: none;
        visibility: hidden;
    }

    .toggle-box { display: none; }

    .input-box { margin: 14px 0; }

    .input-box input {
        padding: 15px 46px 9px 40px;
        font-size: 15px;
        border-radius: 10px;
    }

    .floating-label {
        left: 40px;
        font-size: 13px;
    }

    .btn {
        height: 48px;
        font-size: 16px;
        border-radius: 10px;
        margin-top: 6px;
    }

    .forgot-link { margin: -4px 0 8px; }

    .social-icons a {
        padding: 10px;
        font-size: 22px;
        border-radius: 10px;
    }

    .company-section { width: 100%; }

    img {
        height: 72px !important;
        width: 72px !important;
    }

    .loading-card { padding: 24px 28px; }
}

/* Small phones */
@media screen and (max-width: 400px) {
    .form-box { padding: 20px 14px; }

    .container h1 { font-size: 20px; }

    .input-box { margin: 10px 0; }

    .input-box input {
        font-size: 14px;
        padding: 14px 42px 8px 38px;
    }

    .floating-label {
        left: 38px;
        font-size: 12px;
    }

    .btn {
        height: 46px;
        font-size: 15px;
    }

    img {
        height: 56px !important;
        width: 56px !important;
    }

    .loading-card { padding: 20px 22px; }

    .loading-card span { font-size: 13px; }
}
