/* ============================================
   CSS VARIABLES
   WhatsApp-inspired design tokens with RGB effects
============================================ */
:root {
    /* WhatsApp Background colors */
    --bg-dark: #111B21;
    --bg-mid: #1F2A32;
    --bg-light: #2A3942;
    --bg-card: rgba(31, 42, 50, 0.85);

    /* WhatsApp Brand Colors */
    --whatsapp-green: #00A884;
    --whatsapp-teal: #00897B;
    --whatsapp-light: #25D366;
    --whatsapp-cyan: #00BCD4;

    /* RGB Gaming Accents (WhatsApp inspired) */
    --rgb-green: #00FF7F;
    --rgb-teal: #00CED1;
    --rgb-cyan: #00FFFF;
    --rgb-mint: #98FF98;

    /* Accent colors */
    --cyan: #00A884;
    --purple: #9C27B0;
    --blue: #2196F3;
    --pink: #E91E63;
    --violet: #7C4DFF;

    /* Text colors */
    --text-primary: #E9EDEF;
    --text-secondary: #8696A0;
    --text-muted: #667781;

    /* Gradient colors */
    --gradient-start: #00A884;
    --gradient-mid: #00BCD4;
    --gradient-end: #00FF7F;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-round: 50px;

    /* Shadows */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    --shadow-glow-green: 0 0 30px rgba(0, 168, 132, 0.4);
    --shadow-glow-teal: 0 0 30px rgba(0, 206, 209, 0.3);
    --shadow-glow-mint: 0 0 30px rgba(0, 255, 127, 0.3);

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Space Grotesk', 'Sora', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
}

/* ============================================
   RESET & BASE STYLES
   Normalize browser defaults
============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-primary);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ============================================
   ANIMATED BACKGROUND
   WhatsApp-inspired floating orbs
============================================ */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-dark);
}

/* WhatsApp-style mesh gradient */
.mesh-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(0, 168, 132, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(0, 188, 212, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(0, 255, 127, 0.08) 0%, transparent 60%),
        linear-gradient(180deg, #0D1418 0%, var(--bg-dark) 30%, #1A2C34 100%);
}

/* Floating orbs with WhatsApp colors */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, var(--whatsapp-green) 0%, var(--whatsapp-teal) 100%);
    top: -15%;
    left: -10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, var(--whatsapp-teal) 0%, var(--rgb-cyan) 100%);
    top: 40%;
    right: -20%;
    animation-delay: -5s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, var(--rgb-mint) 0%, var(--whatsapp-green) 100%);
    bottom: -15%;
    left: 20%;
    animation-delay: -10s;
}

.orb-4 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, var(--rgb-teal) 0%, var(--whatsapp-cyan) 100%);
    top: 25%;
    left: 55%;
    animation-delay: -15s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(50px, 50px) scale(1.1);
    }
    50% {
        transform: translate(0, 100px) scale(0.9);
    }
    75% {
        transform: translate(-50px, 50px) scale(1.05);
    }
}

/* ============================================
   MAIN CONTAINER
   Centered layout wrapper
============================================ */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
}

/* ============================================
   HEADER SECTION
   WhatsApp-style header with gradient
============================================ */
.header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.title {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 800;
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
}

.title-gradient {
    background: linear-gradient(135deg, var(--whatsapp-green) 0%, var(--rgb-teal) 50%, var(--rgb-mint) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 60px rgba(0, 168, 132, 0.5);
}

.subtitle {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--text-secondary);
    font-weight: 400;
}

/* ============================================
   PATTERN TABS
   WhatsApp green themed tabs with RGB borders
============================================ */
.tabs-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.tab {
    position: relative;
    padding: var(--space-sm) var(--space-lg);
    min-width: 70px;
    background: rgba(13, 20, 24, 0.8);
    border: 1px solid rgba(0, 168, 132, 0.15);
    border-radius: var(--radius-round);
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all var(--transition-base);
    overflow: hidden;
}

.tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius-round);
    padding: 2px;
    background: linear-gradient(135deg, var(--whatsapp-green), var(--rgb-teal), var(--rgb-mint));
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.tab:hover {
    background: rgba(0, 168, 132, 0.1);
    border-color: rgba(0, 168, 132, 0.3);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.tab.active {
    color: var(--text-primary);
    background: rgba(0, 168, 132, 0.15);
    border-color: var(--whatsapp-green);
    box-shadow:
        0 0 20px rgba(0, 168, 132, 0.3),
        0 0 40px rgba(0, 206, 209, 0.15);
}

.tab.active::before {
    opacity: 1;
    animation: rgb-border-green 3s linear infinite;
}

.tab.active::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(0, 168, 132, 0.15) 45%,
        rgba(0, 255, 127, 0.15) 50%,
        rgba(0, 206, 209, 0.15) 55%,
        transparent 60%
    );
    animation: shimmer-green 3s linear infinite;
}

@keyframes rgb-border-green {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(30deg);
    }
}

@keyframes shimmer-green {
    0% {
        transform: translateX(-100%) rotate(0deg);
    }
    100% {
        transform: translateX(100%) rotate(0deg);
    }
}

/* ============================================
   PATTERN DESCRIPTION
   Dynamic description text
============================================ */
.description {
    text-align: center;
    margin-bottom: var(--space-xl);
    min-height: 24px;
}

.description-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: all var(--transition-base);
}

/* ============================================
   GENERATE BUTTON
   WhatsApp green button with RGB effects
============================================ */
.generate-btn {
    position: relative;
    padding: var(--space-md) var(--space-2xl);
    min-width: 200px;
    background: linear-gradient(135deg, var(--whatsapp-green) 0%, var(--whatsapp-teal) 100%);
    border: none;
    border-radius: var(--radius-round);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    overflow: hidden;
    transition: all var(--transition-base);
    box-shadow:
        0 4px 15px rgba(0, 168, 132, 0.4),
        0 4px 30px rgba(0, 206, 209, 0.2);
}

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius-round);
    padding: 2px;
    background: linear-gradient(90deg, var(--whatsapp-green), var(--rgb-teal), var(--rgb-mint), var(--whatsapp-green));
    background-size: 300% 100%;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--transition-base);
    animation: gradient-flow-green 2s linear infinite;
}

.generate-btn:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 25px rgba(0, 168, 132, 0.5),
        0 8px 40px rgba(0, 255, 127, 0.3);
}

.generate-btn:hover::before {
    opacity: 1;
}

.generate-btn:active {
    transform: translateY(-1px);
}

@keyframes gradient-flow-green {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 300% 50%;
    }
}

/* Ripple effect container */
.ripple-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: ripple-green 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-green {
    to {
        transform: translate(-50%, -50%) scale(100);
        opacity: 0;
    }
}

/* ============================================
   RESULTS GRID
   2x5 grid of WhatsApp-style cards
============================================ */
.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    width: 100%;
    margin-top: var(--space-xl);
    opacity: 0;
    transform: translateY(20px);
    transition: all var(--transition-slow);
}

.results-grid.visible {
    opacity: 1;
    transform: translateY(0);
}

.results-grid.hidden {
    display: none;
}

/* ============================================
   RESULT CARDS
   WhatsApp glass-style cards with RGB border
============================================ */
.result-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 168, 132, 0.15);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: default;
    transition: all var(--transition-base);
    animation: card-enter 0.4s ease forwards;
    opacity: 0;
    transform: scale(0.9) translateY(10px);
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius-lg);
    padding: 1px;
    background: linear-gradient(135deg, var(--whatsapp-green), transparent, var(--rgb-teal));
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.5;
    transition: opacity var(--transition-base);
}

.result-card:hover {
    background: rgba(0, 168, 132, 0.12);
    transform: translateY(-4px);
    border-color: rgba(0, 168, 132, 0.4);
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(0, 168, 132, 0.15);
}

.result-card:hover::before {
    opacity: 1;
    background: linear-gradient(135deg, var(--whatsapp-green), var(--rgb-teal), var(--rgb-mint));
}

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

/* Nickname text */
.nickname {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    letter-spacing: 0.05em;
    text-shadow: 0 0 20px rgba(0, 168, 132, 0.4);
}

/* Copy button - WhatsApp style */
.copy-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(0, 168, 132, 0.1);
    border: 1px solid rgba(0, 168, 132, 0.2);
    border-radius: var(--radius-sm);
    color: var(--whatsapp-green);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.copy-btn svg {
    width: 18px;
    height: 18px;
    transition: all var(--transition-fast);
}

.copy-btn:hover {
    background: rgba(0, 168, 132, 0.2);
    border-color: var(--whatsapp-green);
    color: var(--rgb-mint);
    box-shadow: 0 0 15px rgba(0, 168, 132, 0.4);
}

.copy-btn.copied {
    background: rgba(37, 211, 102, 0.2);
    border-color: var(--whatsapp-light);
    color: var(--whatsapp-light);
}

/* ============================================
   BOTTOM BUTTONS
   WhatsApp-styled action buttons
============================================ */
.bottom-buttons {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    opacity: 0;
    transform: translateY(20px);
    transition: all var(--transition-slow);
}

.bottom-buttons.visible {
    opacity: 1;
    transform: translateY(0);
}

.bottom-buttons.hidden {
    display: none;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    background: transparent;
    border: 1px solid rgba(0, 168, 132, 0.25);
    border-radius: var(--radius-round);
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.action-btn svg {
    width: 18px;
    height: 18px;
}

.action-btn:hover {
    background: rgba(0, 168, 132, 0.1);
    border-color: var(--whatsapp-green);
    color: var(--text-primary);
    transform: translateY(-2px);
}

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

.action-btn.primary {
    background: linear-gradient(135deg, rgba(0, 168, 132, 0.2), rgba(0, 206, 209, 0.15));
    border-color: rgba(0, 168, 132, 0.4);
    color: var(--whatsapp-green);
}

.action-btn.primary:hover {
    background: linear-gradient(135deg, rgba(0, 168, 132, 0.3), rgba(0, 206, 209, 0.25));
    box-shadow: 0 0 20px rgba(0, 168, 132, 0.25);
}

/* ============================================
   TOAST NOTIFICATION
   WhatsApp green success message
============================================ */
.toast {
    position: fixed;
    top: var(--space-lg);
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: rgba(13, 20, 24, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(37, 211, 102, 0.3);
    border-radius: var(--radius-round);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(37, 211, 102, 0.2);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    width: 20px;
    height: 20px;
    color: var(--whatsapp-light);
}

.toast-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--whatsapp-light);
}

/* ============================================
   RESPONSIVE DESIGN
   Mobile and tablet adaptations
============================================ */
@media (max-width: 768px) {
    .container {
        padding: var(--space-lg) var(--space-md);
    }

    .header {
        margin-bottom: var(--space-xl);
    }

    .tabs-container {
        gap: var(--space-xs);
    }

    .tab {
        padding: var(--space-xs) var(--space-md);
        min-width: 55px;
        font-size: 0.75rem;
    }

    .generate-btn {
        min-width: 180px;
        padding: var(--space-sm) var(--space-xl);
    }

    .results-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .result-card {
        padding: var(--space-sm) var(--space-md);
    }

    .nickname {
        font-size: 1.1rem;
    }

    .bottom-buttons {
        flex-direction: column;
        width: 100%;
    }

    .action-btn {
        justify-content: center;
        width: 100%;
    }

    .orb {
        filter: blur(60px);
        opacity: 0.35;
    }

    .orb-1 {
        width: 300px;
        height: 300px;
    }

    .orb-2 {
        width: 400px;
        height: 400px;
    }

    .orb-3 {
        width: 250px;
        height: 250px;
    }

    .orb-4 {
        width: 200px;
        height: 200px;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .tab {
        padding: var(--space-xs) var(--space-sm);
        min-width: 48px;
        font-size: 0.7rem;
    }
}

/* ============================================
   UTILITY ANIMATIONS
   Helper animations for various effects
============================================ */
@keyframes pulse-glow-green {
    0%, 100% {
        box-shadow:
            0 0 20px rgba(0, 168, 132, 0.4),
            0 0 40px rgba(0, 206, 209, 0.2);
    }
    50% {
        box-shadow:
            0 0 30px rgba(0, 168, 132, 0.6),
            0 0 60px rgba(0, 255, 127, 0.3);
    }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   ACCESSIBILITY
   Focus states and screen reader support
============================================ */
.tab:focus-visible,
.generate-btn:focus-visible,
.action-btn:focus-visible,
.copy-btn:focus-visible {
    outline: 2px solid var(--whatsapp-green);
    outline-offset: 2px;
}

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

    .orb {
        animation: none;
    }

    .tab.active::before,
    .tab.active::after {
        animation: none;
    }
}
