/* ===== WiFine Captive Portal Styles ===== */

/* ===== CSS Variables - WiFine Brand ===== */
:root {
    /* Brand Colors */
    --wifine-primary: #00d4aa;
    --wifine-primary-dark: #00b894;
    --wifine-primary-light: rgba(0, 212, 170, 0.15);
    --wifine-accent: #6c5ce7;
    --wifine-accent-light: rgba(108, 92, 231, 0.15);

    /* Backgrounds */
    --bg-dark: #0a0f1c;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-input: rgba(255, 255, 255, 0.06);

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-input: rgba(255, 255, 255, 0.12);
    --border-focus: var(--wifine-primary);

    /* Text */
    --text-white: #ffffff;
    --text-light: rgba(255, 255, 255, 0.85);
    --text-muted: rgba(255, 255, 255, 0.5);
    --text-dim: rgba(255, 255, 255, 0.35);

    /* Effects */
    --glow-primary: 0 0 40px rgba(0, 212, 170, 0.3);
    --shadow-card: 0 25px 80px -20px rgba(0, 0, 0, 0.5);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 0.2s;
    --duration-normal: 0.4s;

    /* Spacing & Radius */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    color: var(--text-white);
    padding: 20px;
    overflow-x: hidden;
}

/* Animated Gradient Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(0, 212, 170, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(108, 92, 231, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(0, 212, 170, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* Floating Particles Effect */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20% 30%, rgba(0, 212, 170, 0.3), transparent),
        radial-gradient(2px 2px at 80% 70%, rgba(108, 92, 231, 0.3), transparent),
        radial-gradient(1px 1px at 60% 20%, rgba(255, 255, 255, 0.2), transparent),
        radial-gradient(1px 1px at 40% 80%, rgba(255, 255, 255, 0.2), transparent);
    pointer-events: none;
    z-index: -1;
    animation: floatParticles 20s linear infinite;
}

@keyframes floatParticles {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

/* ===== Container ===== */
.container {
    width: 100%;
    max-width: 440px;
}

/* ===== Card Styles ===== */
.captive-card,
.success-card {
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    box-shadow: var(--shadow-card);
    animation: cardReveal 0.8s var(--ease-out);
}

@keyframes cardReveal {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== WiFine Brand Logo ===== */
.logo-section {
    text-align: center;
    margin-bottom: 32px;
}

.brand-logo {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -2px;
    margin-bottom: 8px;
    position: relative;
    display: inline-block;
}

.logo-wifi {
    color: var(--text-white);
}

.logo-ine {
    background: linear-gradient(135deg, var(--wifine-primary) 0%, var(--wifine-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-logo::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--wifine-primary), var(--wifine-accent));
    border-radius: 2px;
}

.tagline {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 12px;
}

/* ===== Welcome Section ===== */
.welcome-section {
    text-align: center;
    margin-bottom: 32px;
}

.welcome-section h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 8px;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ===== Form Styles ===== */
.captive-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-light);
    margin-left: 4px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 16px 20px;
    padding-right: 50px;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    color: var(--text-white);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--duration-fast) ease;
    outline: none;
}

/* RTL Support for Arabic */
[dir="rtl"] .form-group input[type="text"],
[dir="rtl"] .form-group input[type="email"],
[dir="rtl"] .form-group input[type="password"] {
    padding-right: 50px;
    padding-left: 20px;
    text-align: right;
}

[dir="rtl"] .form-group.password-group input[type="password"] {
    padding-left: 50px;
}

[dir="rtl"] .input-icon {
    left: auto;
    right: 16px;
}

[dir="rtl"] .form-group label {
    margin-left: 0;
    margin-right: 4px;
}

[dir="rtl"] .modal-body ul {
    padding-left: 0;
    padding-right: 24px;
}

.form-group input::placeholder {
    color: var(--text-dim);
}

.form-group input:focus {
    border-color: var(--wifine-primary);
    background: rgba(0, 212, 170, 0.05);
    box-shadow: 0 0 0 4px var(--wifine-primary-light);
}

.input-icon {
    position: absolute;
    right: 16px;
    bottom: 14px;
    width: 22px;
    height: 22px;
    color: var(--text-dim);
    pointer-events: none;
    transition: color var(--duration-fast) ease;
}

.form-group input:focus+.input-icon {
    color: var(--wifine-primary);
}

.input-icon svg {
    width: 100%;
    height: 100%;
}

/* ===== Terms Checkbox ===== */
.terms-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.terms-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 1px;
    accent-color: var(--wifine-primary);
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 4px;
}

.terms-group label {
    line-height: 1.6;
    cursor: pointer;
}

.terms-group a {
    color: var(--wifine-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--duration-fast) ease;
}

.terms-group a:hover {
    color: var(--wifine-primary-dark);
    text-decoration: underline;
}

/* ===== Connect Button ===== */
.connect-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 18px 28px;
    background: linear-gradient(135deg, var(--wifine-primary) 0%, var(--wifine-primary-dark) 100%);
    color: var(--bg-dark);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    overflow: hidden;
    margin-top: 8px;
}

.connect-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.connect-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--glow-primary);
}

.connect-btn:hover::before {
    left: 100%;
}

.connect-btn:active {
    transform: translateY(-1px);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    transition: transform var(--duration-fast) ease;
}

.btn-icon svg {
    width: 100%;
    height: 100%;
}

.connect-btn:hover .btn-icon {
    transform: scale(1.1);
    animation: wifiPulse 1s ease infinite;
}

@keyframes wifiPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* ===== Card Footer ===== */
.card-footer {
    margin-top: 32px;
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
}

.card-footer>p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.card-footer a {
    color: var(--wifine-primary);
    text-decoration: none;
    font-weight: 500;
}

.card-footer a:hover {
    text-decoration: underline;
}

.powered-by {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.footer-brand {
    font-weight: 700;
    background: linear-gradient(135deg, var(--wifine-primary), var(--wifine-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Success Card ===== */
.success-card {
    text-align: center;
    padding: 60px 40px;
}

.success-animation {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 32px;
}

.wifi-waves {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
}

.wifi-waves span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 3px solid var(--wifine-primary);
    border-radius: 50%;
    animation: waveExpand 2s ease-out infinite;
}

.wifi-waves span:nth-child(1) {
    animation-delay: 0s;
}

.wifi-waves span:nth-child(2) {
    animation-delay: 0.4s;
}

.wifi-waves span:nth-child(3) {
    animation-delay: 0.8s;
}

@keyframes waveExpand {
    0% {
        width: 40px;
        height: 40px;
        opacity: 0.8;
    }

    100% {
        width: 120px;
        height: 120px;
        opacity: 0;
    }
}

.check-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--wifine-primary), var(--wifine-primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: checkPop 0.5s var(--ease-out) 0.2s backwards;
}

@keyframes checkPop {
    0% {
        transform: translate(-50%, -50%) scale(0);
    }

    70% {
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

.check-circle svg {
    width: 35px;
    height: 35px;
    color: var(--bg-dark);
}

.success-card h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 8px;
}

.success-card>p {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.highlight {
    color: var(--wifine-primary);
    font-weight: 600;
}

.redirect-text {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 32px;
}

#countdown {
    font-weight: 700;
    color: var(--wifine-primary);
    font-size: 1.1rem;
}

.brand-watermark {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--wifine-primary) 0%, var(--wifine-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.4;
}

/* ===== Modal Styles ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 15, 28, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    max-width: 480px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlide 0.4s var(--ease-out);
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-white);
}

.close-modal {
    width: 36px;
    height: 36px;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast) ease;
    line-height: 1;
}

.close-modal:hover {
    background: var(--wifine-primary-light);
    border-color: var(--wifine-primary);
    color: var(--wifine-primary);
}

.modal-body {
    padding: 28px;
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.8;
}

.modal-brand {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--wifine-primary), var(--wifine-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.modal-body ul {
    margin: 16px 0;
    padding-left: 24px;
}

.modal-body li {
    margin-bottom: 10px;
    color: var(--text-muted);
}

.modal-body li::marker {
    color: var(--wifine-primary);
}

/* ===== Utility Classes ===== */
.hidden {
    display: none !important;
}

/* ===== Loading State ===== */
.connect-btn.loading {
    pointer-events: none;
    opacity: 0.85;
}

.connect-btn.loading .btn-text,
.connect-btn.loading .btn-icon {
    opacity: 0;
}

.connect-btn.loading::after {
    content: '';
    position: absolute;
    width: 26px;
    height: 26px;
    border: 3px solid rgba(10, 15, 28, 0.2);
    border-top-color: var(--bg-dark);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Error Message ===== */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

/* ===== Responsive Design ===== */
@media (max-width: 480px) {

    .captive-card,
    .success-card {
        padding: 36px 24px;
        border-radius: var(--radius-md);
    }

    .brand-logo {
        font-size: 2.5rem;
    }

    .welcome-section h1 {
        font-size: 1.3rem;
    }

    .tagline {
        font-size: 0.75rem;
        letter-spacing: 1.5px;
    }

    .success-animation {
        width: 100px;
        height: 100px;
    }

    .check-circle {
        width: 60px;
        height: 60px;
    }

    .check-circle svg {
        width: 28px;
        height: 28px;
    }
}