:root {
    --primary: #0066FF;
    /* Electric Blue */
    --primary-glow: rgba(0, 102, 255, 0.4);
    --secondary: #00F2FE;
    /* Vivid Cyan */
    --bg-dark: #050505;
    --bg-dark-accent: #0F0F0F;
    --bg-surface: #161616;
    --text-main: #FFFFFF;
    --text-muted: #A0A0A0;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow-premium: 0 20px 40px rgba(0, 0, 0, 0.4);
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --font-family: 'Outfit', 'Inter', system-ui, sans-serif;

    /* Light Theme Overrides */
    --bg-light: #F8FAFC;
    --bg-light-accent: #FFFFFF;
    --text-light-main: #1E293B;
    --text-light-muted: #64748B;

    /* Blueprint Aesthetic Core */
    --blueprint-grid: rgba(0, 102, 255, 0.05);
    --blueprint-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --nodal-blue: #0066FF;
}

.light-theme {
    --bg-dark: var(--bg-light);
    --bg-dark-accent: var(--bg-light-accent);
    --bg-surface: #FFFFFF;
    --text-main: var(--text-light-main);
    --text-muted: var(--text-light-muted);
    --glass: rgba(0, 0, 0, 0.02);
    --glass-border: rgba(0, 0, 0, 0.08);
    --shadow-premium: var(--blueprint-shadow);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    font-weight: 800;
    letter-spacing: -0.02em;
}

.glass-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.btn {
    padding: 0.8rem 1.8rem;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #0044CC);
    color: #FFFFFF !important;
    box-shadow: 0 10px 25px var(--primary-glow);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 20px 40px var(--primary-glow);
    filter: brightness(1.1);
}

.gradient-text {
    background: linear-gradient(135deg, var(--text-main), var(--text-muted));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.referral-badge {
    background: rgba(0, 102, 255, 0.1);
    border: 1px solid var(--primary);
    padding: 6px 14px;
    border-radius: 50px;
    color: var(--primary) !important;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.referral-badge:hover {
    background: var(--primary);
    color: white !important;
    box-shadow: 0 0 15px var(--primary-glow);
    transform: scale(1.05);
}

.theme-toggle-btn {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    background: var(--glass);
    color: var(--primary);
    transform: translateY(-2px);
}

.light-theme .theme-toggle-btn {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-light-muted);
}

.iris-text {
    background: linear-gradient(135deg, #7C3AED, var(--primary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Navbar */
.navbar {
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6%;
    background: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(20px);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -1px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo span {
    background: linear-gradient(to bottom right, #fff, #999);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    color: var(--text-muted);
}

.nav-link:hover {
    color: white;
}

/* Animations */
@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.animate-entrance {
    animation: fadeInScale 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Purchase Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.credits-modal {
    background: #121212;
    width: 650px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    padding: 35px;
    position: relative;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.btn-close-modal {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 8px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

.packages-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.package-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #222;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
    position: relative;
}

.package-card:hover {
    border-color: #444;
}

.package-card.selected {
    border: 2px solid var(--primary);
    background: rgba(0, 102, 255, 0.05);
}

.package-card .popular-tag {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
}

.package-card h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: white !important;
}

.package-card .price {
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: 800;
    margin-bottom: 5px;
    display: block;
}

.package-card .sub-price {
    font-size: 0.75rem;
    color: #666;
}

.payment-section label {
    display: block;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 15px;
}

.card-input-box {
    background: #0A0A0A;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.card-input-box input {
    background: transparent;
    border: none;
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    width: 100%;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
}

.btn-pix {
    background: #00A38E;
    color: white;
    border: none;
    padding: 14px 25px;
    border-radius: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

/* Global Mobile Fixes */
@media (max-width: 900px) {
    body {
        flex-direction: column !important;
        overflow-y: auto !important;
    }

    .sidebar,
    .admin-sidebar {
        width: 100% !important;
        height: 65px !important;
        flex-direction: row !important;
        padding: 0 10px !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        gap: 5px !important;
        justify-content: space-around !important;
        border-right: none !important;
        border-top: 1px solid var(--glass-border) !important;
        background: rgba(15, 15, 15, 0.9) !important;
        backdrop-filter: blur(20px) !important;
        z-index: 5000 !important;
    }

    .sidebar-logo,
    .sidebar-bottom,
    .logo,
    .sidebar-item[title="Perfil"],
    .sidebar-item[title="Sair"] {
        display: none !important;
    }

    /* Show Exit/Logout or Profile in a very limited way if needed, but for now keep it clean */
    .sidebar-item,
    .nav-item {
        width: 50px !important;
        height: 50px !important;
        padding: 0 !important;
        margin: 0 !important;
        justify-content: center !important;
        font-size: 0 !important;
        border-radius: 12px !important;
    }

    .sidebar-item svg {
        width: 22px !important;
        height: 22px !important;
    }

    .app-container,
    .main-container,
    .admin-main {
        padding-bottom: 80px !important;
        min-height: 100vh !important;
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .topbar {
        padding: 15px !important;
        height: auto !important;
        flex-direction: column !important;
        gap: 12px !important;
        align-items: center !important;
        text-align: center !important;
    }

    .topbar-title h2 {
        font-size: 1.1rem !important;
    }

    .credits-capsule {
        width: 100% !important;
        justify-content: center !important;
        padding: 10px 15px !important;
        font-size: 0.75rem !important;
    }

    .stat-grid,
    .package-editor {
        grid-template-columns: 1fr !important;
        padding: 15px !important;
    }

    .modal-overlay {
        padding: 0 !important;
        align-items: flex-end !important;
    }

    .modal-content,
    .credits-modal,
    #referralModal>div {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 20px 20px 0 0 !important;
        padding: 25px 20px !important;
    }

    /* Flows/Editor Surface warnings */
    .blueprint-surface {
        min-width: 100vw !important;
        min-height: 100vh !important;
    }

    .bottom-toolbar {
        bottom: 80px !important;
        width: 100% !important;
        left: 0 !important;
        transform: none !important;
        padding: 10px !important;
        overflow-x: auto !important;
        border-radius: 0 !important;
        border-right: none !important;
        border-left: none !important;
        display: flex !important;
        justify-content: flex-start !important;
        gap: 10px !important;
        background: rgba(15, 15, 15, 0.95) !important;
        backdrop-filter: blur(15px) !important;
    }

    .toolbar-item {
        flex-shrink: 0 !important;
    }

    /* Fix image/preview overflow */
    .preview-block {
        min-width: unset !important;
        width: 100% !important;
        max-width: 350px !important;
    }
}

.btn-card-pay {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px 25px;
    border-radius: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

/* Processing & Loading States */
.processing-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 10px;
    text-align: center;
    gap: 15px;
}

.coffee-icon {
    font-size: 3rem;
    animation: coffee-float 3s ease-in-out infinite, coffee-steam 2s infinite alternate;
    line-height: 1;
    filter: drop-shadow(0 0 15px var(--primary-glow));
}

@keyframes coffee-float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-10px) rotate(5deg);
    }
}

@keyframes coffee-steam {
    from {
        opacity: 0.6;
        filter: blur(1px);
    }

    to {
        opacity: 1;
        filter: blur(0px);
    }
}

.processing-badge {
    background: rgba(255, 255, 255, 0.1);
    color: #BBB;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 5px;
}

.processing-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: blink 1.2s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.3;
        transform: scale(0.8);
    }
}

.credits-badge {
    background: rgba(0, 102, 255, 0.1);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 800;
    margin-left: auto;
}

/* Fix for preview containers */
.preview-block {
    width: 320px;
    max-width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    z-index: 1000;
}

.preview-img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    display: block;
    background: #000;
    max-height: 80vh;
    /* Permite imagens grandes mas evita que estourem a tela verticalmente */
}