/* =====================================================
   KriptoCopyTrade - Modern Auth Styles
   Figma-style Dark Mode with Glassmorphism
   ===================================================== */

:root {
    /* Dark Mode Colors */
    --bg-dark: #0a0e17;
    --bg-darker: #060912;
    --bg-card: rgba(13, 17, 28, 0.7);
    --bg-glass: rgba(20, 27, 45, 0.6);

    /* Neon Accent Colors */
    --neon-green: #00ff88;
    --neon-green-dim: rgba(0, 255, 136, 0.5);
    --neon-green-glow: rgba(0, 255, 136, 0.3);
    --neon-cyan: #00d4ff;
    --neon-cyan-dim: rgba(0, 212, 255, 0.5);
    --neon-cyan-glow: rgba(0, 212, 255, 0.2);
    --neon-purple: #a855f7;

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);

    /* Border & Effects */
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(0, 255, 136, 0.3);

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    /* Shadows */
    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-neon: 0 0 40px rgba(0, 255, 136, 0.15);
    --shadow-input: 0 0 20px rgba(0, 255, 136, 0.1);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body.auth-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* =====================================================
   3D Background Canvas
   ===================================================== */
#crypto-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Background Gradient Overlay */
.auth-bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(0, 255, 136, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(0, 212, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(168, 85, 247, 0.05) 0%, transparent 70%);
    z-index: 1;
    pointer-events: none;
}

/* Particle Container */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--neon-green);
    border-radius: 50%;
    opacity: 0;
    animation: particle-float 15s infinite ease-in-out;
}

.particle:nth-child(odd) {
    background: var(--neon-cyan);
}

@keyframes particle-float {
    0%, 100% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(1);
    }
}

/* =====================================================
   Main Container
   ===================================================== */
.auth-container {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* =====================================================
   Language Switcher (Top Right)
   ===================================================== */
.lang-switcher-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
}

.lang-switch {
    display: flex;
    gap: 4px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
}

.lang-switch a {
    padding: 8px 14px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-fast);
    letter-spacing: 0.5px;
}

.lang-switch a:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.lang-switch a.active {
    background: linear-gradient(135deg, var(--neon-green) 0%, var(--neon-cyan) 100%);
    color: var(--bg-dark);
    box-shadow: 0 4px 15px var(--neon-green-glow);
}

/* =====================================================
   Login Card - Glassmorphism
   ===================================================== */
.login-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-glass);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-glass);
    box-shadow:
        var(--shadow-glass),
        var(--shadow-neon),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    padding: 48px 40px;
    position: relative;
    overflow: hidden;

    /* Fade-in animation */
    animation: card-fade-in 0.8s var(--transition-slow) forwards;
    opacity: 0;
    transform: translateY(30px);
}

@keyframes card-fade-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Glow Effect */
.login-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        var(--neon-green-glow) 60deg,
        transparent 120deg,
        var(--neon-cyan-glow) 180deg,
        transparent 240deg,
        var(--neon-green-glow) 300deg,
        transparent 360deg
    );
    animation: card-glow-rotate 8s linear infinite;
    opacity: 0.3;
    z-index: -1;
}

@keyframes card-glow-rotate {
    to {
        transform: rotate(360deg);
    }
}

.login-card::after {
    content: '';
    position: absolute;
    inset: 1px;
    background: var(--bg-glass);
    border-radius: calc(var(--radius-xl) - 1px);
    z-index: -1;
}

/* =====================================================
   Logo & Branding
   ===================================================== */
.auth-logo {
    text-align: center;
    margin-bottom: 12px;
}

.logo-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--neon-green) 0%, var(--neon-cyan) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 30px var(--neon-green-glow);
    animation: logo-pulse 3s ease-in-out infinite;
}

@keyframes logo-pulse {
    0%, 100% {
        box-shadow: 0 8px 30px var(--neon-green-glow);
    }
    50% {
        box-shadow: 0 8px 50px var(--neon-cyan-glow), 0 0 60px var(--neon-green-glow);
    }
}

.logo-icon i {
    font-size: 32px;
    color: var(--bg-dark);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--neon-green) 50%, var(--neon-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 8px;
    font-weight: 400;
}

/* =====================================================
   Form Title
   ===================================================== */
.form-header {
    text-align: center;
    margin: 32px 0 28px;
}

.form-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* =====================================================
   Alerts
   ===================================================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    font-size: 0.9rem;
    animation: alert-slide-in 0.3s ease forwards;
}

@keyframes alert-slide-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert i {
    font-size: 1.2rem;
    margin-top: 1px;
    flex-shrink: 0;
}

.alert-error {
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
    border: 1px solid rgba(255, 71, 87, 0.3);
}

.alert-success {
    background: rgba(0, 255, 136, 0.1);
    color: var(--neon-green);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.alert ul {
    margin: 0;
    padding-left: 16px;
}

/* =====================================================
   Form Styles
   ===================================================== */
.auth-form {
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0.3px;
}

/* Input Wrapper */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper > i:first-child {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 1.15rem;
    transition: var(--transition-fast);
    z-index: 2;
}

.input-wrapper input {
    width: 100%;
    padding: 16px 16px 16px 50px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition-normal);
    position: relative;
    z-index: 1;
}

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

/* Input Focus Glow Effect */
.input-wrapper input:focus {
    outline: none;
    border-color: var(--neon-green-dim);
    background: rgba(0, 255, 136, 0.03);
    box-shadow:
        0 0 0 3px rgba(0, 255, 136, 0.1),
        var(--shadow-input);
}

.input-wrapper input:focus + i,
.input-wrapper:focus-within > i:first-child {
    color: var(--neon-green);
}

/* Password Toggle */
.toggle-password {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    z-index: 2;
    transition: var(--transition-fast);
}

.toggle-password:hover {
    color: var(--neon-cyan);
}

/* =====================================================
   Checkbox & Remember Me
   ===================================================== */
.form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--neon-green);
    cursor: pointer;
    border-radius: 4px;
}

.forgot-link {
    color: var(--neon-cyan);
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--transition-fast);
}

.forgot-link:hover {
    color: var(--neon-green);
    text-decoration: underline;
}

/* =====================================================
   Primary Button
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--neon-green) 0%, #00cc6a 100%);
    color: var(--bg-dark);
    box-shadow: 0 4px 20px var(--neon-green-glow);
}

.btn-primary::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: 0.5s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 30px var(--neon-green-glow),
        0 0 60px rgba(0, 255, 136, 0.2);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-block {
    width: 100%;
}

.btn i {
    font-size: 1.15rem;
}

/* =====================================================
   Divider
   ===================================================== */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 28px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--border-glass),
        transparent
    );
}

.auth-divider span {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

/* =====================================================
   Footer Links
   ===================================================== */
.auth-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.auth-footer a {
    color: var(--neon-cyan);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-fast);
}

.auth-footer a:hover {
    color: var(--neon-green);
    text-decoration: underline;
}

/* =====================================================
   Page Footer
   ===================================================== */
.page-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    z-index: 50;
    background: linear-gradient(to top, var(--bg-dark), transparent);
}

.footer-text {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.security-badges {
    display: flex;
    gap: 16px;
}

.security-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.security-badge i {
    font-size: 1rem;
    color: var(--neon-green-dim);
}

/* =====================================================
   Loading State
   ===================================================== */
.btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn.loading .btn-text {
    opacity: 0;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =====================================================
   Responsive Design
   ===================================================== */
@media (max-width: 576px) {
    .auth-container {
        padding: 60px 16px 100px;
    }

    .login-card {
        padding: 36px 24px;
        border-radius: var(--radius-lg);
    }

    .logo-icon {
        width: 56px;
        height: 56px;
    }

    .logo-icon i {
        font-size: 28px;
    }

    .logo-text {
        font-size: 1.3rem;
    }

    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .lang-switcher-container {
        top: 16px;
        right: 16px;
    }

    .page-footer {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }
}

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

    .input-wrapper input {
        padding: 14px 14px 14px 46px;
    }

    .btn {
        padding: 14px 20px;
    }
}

/* =====================================================
   Animations for 3D Elements
   ===================================================== */
@keyframes float-slow {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

@keyframes float-medium {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    33% {
        transform: translateY(-15px) translateX(10px);
    }
    66% {
        transform: translateY(5px) translateX(-5px);
    }
}

/* Candlestick Chart Animation Styles */
.floating-chart {
    position: absolute;
    opacity: 0.15;
    animation: float-slow 8s ease-in-out infinite;
}

.floating-chart:nth-child(2) {
    animation-delay: -2s;
    animation-duration: 10s;
}

.floating-chart:nth-child(3) {
    animation-delay: -4s;
    animation-duration: 12s;
}

/* Grid Lines */
.grid-line {
    position: absolute;
    background: linear-gradient(
        90deg,
        transparent,
        var(--neon-green-glow),
        transparent
    );
    height: 1px;
    width: 100%;
    opacity: 0.1;
    animation: grid-pulse 4s ease-in-out infinite;
}

@keyframes grid-pulse {
    0%, 100% {
        opacity: 0.05;
    }
    50% {
        opacity: 0.15;
    }
}

/* =====================================================
   High Contrast Mode Support
   ===================================================== */
@media (prefers-contrast: high) {
    .login-card {
        border: 2px solid var(--text-secondary);
    }

    .input-wrapper input {
        border: 2px solid var(--text-muted);
    }

    .input-wrapper input:focus {
        border-color: var(--neon-green);
    }
}

/* =====================================================
   Reduced Motion Support
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .login-card {
        opacity: 1;
        transform: none;
    }
}

/* =====================================================
   Enhanced Mobile Responsive Design
   ===================================================== */

/* Extra small devices (320px - 375px) */
@media (max-width: 375px) {
    html {
        font-size: 14px;
    }

    .auth-container {
        padding: 50px 12px 90px;
    }

    .login-card {
        padding: 28px 18px;
        border-radius: var(--radius-lg);
    }

    .logo-icon {
        width: 48px;
        height: 48px;
    }

    .logo-icon i {
        font-size: 24px;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .auth-subtitle {
        font-size: 0.8rem;
    }

    .form-header {
        margin: 20px 0 20px;
    }

    .form-header h2 {
        font-size: 1.2rem;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .form-group label {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }

    .input-wrapper input {
        padding: 12px 12px 12px 42px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .input-wrapper > i:first-child {
        left: 12px;
        font-size: 1rem;
    }

    .toggle-password {
        right: 12px;
    }

    .btn {
        padding: 12px 18px;
        font-size: 0.9rem;
    }

    .form-row {
        gap: 8px;
    }

    .checkbox-label {
        font-size: 0.8rem;
    }

    .forgot-link {
        font-size: 0.8rem;
    }

    .auth-divider {
        margin: 20px 0;
    }

    .auth-footer {
        font-size: 0.85rem;
    }

    .lang-switcher-container {
        top: 12px;
        right: 12px;
    }

    .lang-switch {
        padding: 4px;
    }

    .lang-switch a {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .page-footer {
        padding: 12px;
        gap: 8px;
    }

    .footer-text {
        font-size: 0.7rem;
    }

    .security-badges {
        gap: 8px;
    }

    .security-badge {
        font-size: 0.65rem;
    }

    .security-badge i {
        font-size: 0.85rem;
    }
}

/* Very small phones (320px) */
@media (max-width: 320px) {
    html {
        font-size: 13px;
    }

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

    .logo-icon {
        width: 44px;
        height: 44px;
    }

    .logo-icon i {
        font-size: 20px;
    }

    .logo-text {
        font-size: 1rem;
    }

    .input-wrapper input {
        padding: 10px 10px 10px 38px;
    }

    .security-badges {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .auth-container {
        padding: 20px 16px 60px;
        align-items: flex-start;
    }

    .login-card {
        padding: 20px 24px;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 8px;
    }

    .logo-icon i {
        font-size: 20px;
    }

    .logo-text {
        font-size: 1rem;
    }

    .auth-subtitle {
        display: none;
    }

    .form-header {
        margin: 12px 0;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .input-wrapper input {
        padding: 10px 10px 10px 42px;
    }

    .btn {
        padding: 10px 16px;
    }

    .auth-divider {
        margin: 12px 0;
    }

    .page-footer {
        position: relative;
        margin-top: 16px;
        background: transparent;
    }

    /* Disable 3D background in landscape for performance */
    #crypto-canvas {
        display: none;
    }
}

/* Touch-friendly improvements */
@media (pointer: coarse) {
    .btn {
        min-height: 48px;
    }

    .input-wrapper input {
        min-height: 48px;
    }

    .toggle-password {
        padding: 10px;
    }

    .lang-switch a {
        min-height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .checkbox-label input[type="checkbox"] {
        width: 22px;
        height: 22px;
    }

    /* Active states for touch feedback */
    .btn:active {
        transform: scale(0.98);
    }

    .lang-switch a:active {
        transform: scale(0.95);
    }
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    .auth-container {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .page-footer {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    .lang-switcher-container {
        right: max(16px, env(safe-area-inset-right));
    }
}

/* Tablet portrait (768px - 1024px) */
@media (min-width: 577px) and (max-width: 1024px) {
    .login-card {
        max-width: 420px;
    }

    .auth-container {
        padding: 60px 32px;
    }
}

/* Mobile performance - disable heavy animations */
@media (max-width: 768px) {
    .login-card::before {
        animation: none;
        opacity: 0.15;
    }

    @keyframes logo-pulse {
        0%, 100% {
            box-shadow: 0 4px 20px var(--neon-green-glow);
        }
    }

    .particles {
        display: none;
    }
}
