:root {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --primary-hover: #4f46e5;
    --bg: #0b0f1a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-secondary: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 20px;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
}

.animate-drift {
    animation: drift 20s infinite alternate ease-in-out;
}

@keyframes drift {
    from {
        transform: translate(0, 0) scale(1.1);
    }

    to {
        transform: translate(-20px, -20px) scale(1.2);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 10%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 15%, 1) 0, transparent 50%);
    background-attachment: fixed;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Navbar */
.navbar {
    height: 72px;
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
    transition: background 0.3s, border 0.3s;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    cursor: pointer;
}

.logo-icon {
    width: 28px;
    height: 28px;
}

.nav-links {
    display: flex;
    gap: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Glass Effect Utility */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 24px;
    border-radius: var(--radius);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(99, 102, 241, 0.3);
}

/* Screens */
.screen {
    display: none;
    padding-top: 40px;
    padding-bottom: 80px;
    min-height: calc(100vh - 72px - 60px);
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reveal {
    animation: slideInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Shimmer Effect for Highlight Card */
.stat-card.highlight {
    position: relative;
    overflow: hidden;
}

.stat-card.highlight::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 50%,
            transparent 100%);
    animation: shimmer 3s infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

.sub-item {
    transition: all 0.3s ease;
    animation: slideInUp 0.5s ease backwards;
}

/* Electric Border Styles */
.electric-border {
    position: relative;
    padding: 2px;
    background: transparent;
    display: inline-block;
    width: 100%;
    z-index: 1;
}

.eb-canvas-container {
    position: absolute;
    top: -60px;
    left: -60px;
    right: -60px;
    bottom: -60px;
    pointer-events: none;
    z-index: -1;
}

.eb-canvas {
    width: 100%;
    height: 100%;
}

/* Finance Specific */
.narrow {
    max-width: 600px;
    margin: 0 auto;
}

#finance-history-container .sub-item {
    border-radius: 12px;
    margin-bottom: 8px;
    background: var(--glass-bg);
}

#finance-history-container .sub-icon {
    width: 40px;
    height: 40px;
}

.disabled-status {
    opacity: 0.7;
    cursor: default;
    pointer-events: none;
}

.eb-layers {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.eb-glow-1,
.eb-glow-2,
.eb-background-glow {
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.electric-border:hover .eb-glow-1,
.electric-border:hover .eb-glow-2,
.electric-border:hover .eb-background-glow {
    opacity: 1;
}

.eb-glow-1 {
    box-shadow: 0 0 15px 2px var(--electric-border-color, #5227FF);
}

.eb-glow-2 {
    box-shadow: inset 0 0 15px 2px var(--electric-border-color, #5227FF);
}

.eb-content {
    position: relative;
    z-index: 2;
    background: var(--card-bg);
    border-radius: inherit;
    height: 100%;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    margin-top: 48px;
}

.feature-card {
    height: 100%;
    margin-bottom: 0 !important;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--border);
    color: var(--text-main);
}

.btn-block {
    width: 100%;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn-danger-outline:hover {
    background: var(--danger);
    color: white;
}

/* Landing Section */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 40px;
    padding: 60px 20px;
}

.hero-text h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    font-weight: 800;
    margin: 20px 0;
    color: var(--text-main);
}

[data-theme="light"] .hero-text h1 {
    background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-text p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary);
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.hero-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 40px;
}

.hero-stats {
    display: flex;
    gap: 40px;
}

.stat-item strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-item span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.hero-image img {
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius);
}

.section-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 48px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    margin-top: 60px;
}

.feature-card {
    background: var(--card-bg);
    padding: 32px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    width: 48px;
    height: 48px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.feature-card h3 {
    margin-bottom: 12px;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Auth Card */
.auth-card {
    background: var(--card-bg);
    max-width: 400px;
    margin: 60px auto;
    padding: 40px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-secondary);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.875rem;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 40px;
}

.dashboard-header h1 {
    font-size: 1.875rem;
}

.dashboard-actions {
    display: flex;
    gap: 12px;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.stat-card span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-card h3 {
    font-size: 1.75rem;
    margin-top: 4px;
}

.stat-card.highlight h3 {
    color: var(--success);
}

.subscription-list {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.list-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-filters {
    display: flex;
    gap: 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.list-filters span {
    cursor: pointer;
}

.list-filters span.active {
    color: var(--primary);
}

.sub-item {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.sub-item:last-child {
    border-bottom: none;
}

.sub-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sub-icon {
    width: 44px;
    height: 44px;
    background: #f1f5f9;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary);
}

.sub-details h4 {
    font-size: 1rem;
}

.sub-details p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.sub-price {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: right;
}

.sub-price-info {
    display: flex;
    flex-direction: column;
}

.sub-price strong {
    display: block;
    font-size: 1rem;
}

.sub-price span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
}

.btn-delete {
    padding: 8px;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
}

input,
select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal {
    background: var(--card-bg);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* Separator */
.separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.separator::before,
.separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.separator:not(:empty)::before {
    margin-right: .5em;
}

.separator:not(:empty)::after {
    margin-left: .5em;
}

/* Navigation Right Section */
.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.lang-switcher {
    display: flex;
    gap: 8px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
}

.lang-switcher button {
    background: transparent;
    border: none;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.lang-switcher button:hover {
    color: var(--primary);
}

.lang-switcher button.active {
    background: var(--card-bg);
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: rotate(15deg) scale(1.1);
}

/* Footer Social Links */
.footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 60px 40px;
}

.social-links {
    display: flex;
    gap: 20px;
}

.social-links a {
    color: var(--text-secondary);
    transition: color 0.2s;
}

.social-links a:hover {
    color: var(--primary);
}

.social-links i {
    width: 24px;
    height: 24px;
}

.hidden {
    display: none !important;
}

/* Settings */
.settings-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 24px;
}

.settings-section h3 {
    font-size: 1.125rem;
    margin-bottom: 20px;
}

.tg-connect-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    padding: 16px;
    border-radius: 8px;
}

.tg-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.tg-info i {
    color: #0ea5e9;
}

.text-secondary {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.footer {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .nav-content {
        gap: 8px;
    }

    .lang-switcher {
        display: flex;
        gap: 2px;
        background: rgba(255, 255, 255, 0.05);
        padding: 2px;
    }

    .lang-switcher button {
        padding: 4px 6px;
        font-size: 0.7rem;
    }

    .nav-links {
        display: none;
        /* Simplified mobile navigation */
    }

    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 40px 16px;
        gap: 24px;
    }

    .hero-text h1 {
        font-size: 2.25rem;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .hero-stats {
        flex-wrap: wrap;
        justify-content: center;
        gap: 24px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .stats-overview {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .dashboard-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .dashboard-actions .btn {
        flex: 1 1 140px;
    }

    .dashboard-actions {
        width: 100%;
    }

    .dashboard-actions .btn {
        flex: 1;
    }

    .sub-item {
        padding: 12px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .sub-price {
        width: 100%;
        justify-content: space-between;
    }

    .auth-card {
        margin: 20px 16px;
        padding: 24px;
    }

    .modal {
        margin: 16px;
        padding: 20px;
    }

    .nav-text {
        display: none;
    }
}

/* Tablet Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero {
        gap: 20px;
    }

    .hero-text h1 {
        font-size: 2.75rem;
    }

    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}