/* 
   Premium Dark Mode Design for Criptoinvest v2 
   Theme: Deep Space & Neon Glass
*/

:root {
    /* Color Palette */
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(51, 65, 85, 0.8);
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --secondary-gradient: linear-gradient(135deg, #3b82f6 0%, #2dd4bf 100%);
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #f43f5e 100%);
    --success-color: #10b981;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(148, 163, 184, 0.1);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.3);

    /* Typography */
    --font-main: 'Outfit', sans-serif;
}

/* General Reset */
body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 20%);
    background-attachment: fixed;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Container & Layout */
.container {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    max-width: 1200px;
    width: 100%;
    margin-top: 20px;
    transition: transform 0.3s ease;
}

h1,
h2,
h3,
h4,
h5 {
    color: var(--text-main);
    font-weight: 600;
    letter-spacing: -0.02em;
}

h1 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

/* Form Styles */
form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem;
    background: rgba(15, 23, 42, 0.6);
    border: var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
}

form h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
textarea,
select {
    padding: 1rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.3s ease;
    font-family: var(--font-main);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
    background: rgba(30, 41, 59, 0.8);
}

/* Buttons */
button {
    padding: 0.9rem 1.5rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    font-family: var(--font-main);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
    filter: brightness(1.1);
}

button:active {
    transform: translateY(0);
}

/* Navigation */
nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 2rem;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 16px;
}

nav button {
    background: rgba(51, 65, 85, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: none;
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
}

nav button:hover {
    background: rgba(71, 85, 105, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

nav button.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

/* Dashboard Widgets */
#dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.widget-card,
.user-summary-card,
.summary-card,
.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 20px;
    border: var(--glass-border);
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.user-summary-card {
    width: 100%;
    box-sizing: border-box;
}

.widget-card:hover {
    transform: translateY(-3px);
    border-color: rgba(139, 92, 246, 0.3);
}

.widget-card h3 {
    color: var(--text-main);
    margin-top: 0;
    margin-bottom: 1.2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.8rem;
    font-size: 1.2rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
    color: var(--text-main);
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: rgba(15, 23, 42, 0.5);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

th:first-child {
    border-top-left-radius: 12px;
}

th:last-child {
    border-top-right-radius: 12px;
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: rgba(51, 65, 85, 0.3);
}

td img {
    vertical-align: middle;
    margin-right: 0.8rem;
    border-radius: 50%;
}

/* Links */
a {
    color: #8b5cf6;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #a78bfa;
    text-decoration: underline;
}

/* Messages */
#message-area,
#register-message-area,
#forgot-message-area {
    margin-top: 1rem;
    text-align: center;
    padding: 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Chat Bubble & Container */
#chat-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 64px;
    height: 64px;
    background: var(--secondary-gradient);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    z-index: 1002;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#chat-bubble:hover {
    transform: scale(1.1);
}

#chat-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    border: var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
}

.chat-header {
    background: var(--primary-gradient);
    padding: 1.2rem;
    border-bottom: none;
}

.chat-messages {
    background: transparent;
    flex-grow: 1;
    padding: 1.5rem;
}

.chat-message {
    padding: 12px 16px;
    border-radius: 16px;
    margin-bottom: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat-message.sent {
    background: var(--primary-gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.received {
    background: rgba(51, 65, 85, 0.6);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

.chat-input {
    background: rgba(15, 23, 42, 0.8);
    border-top: 1px solid var(--border-color);
    padding: 1.2rem;
}

.chat-input input {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

/* Modal */
.modal-content {
    background: #1e293b;
    border: var(--glass-border);
    color: var(--text-main);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.close-button {
    color: var(--text-muted);
}

.close-button:hover {
    color: var(--text-main);
}

/* ===========================================
   MOBILE HAMBURGER MENU
   =========================================== */

/* Hamburger Button - Hidden by default, shown in mobile */
.hamburger-menu {
    display: none;
    /* Hidden on desktop */
    flex-direction: column;
    cursor: pointer;
    gap: 6px;
    z-index: 1001;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hamburger-menu span {
    width: 24px;
    height: 3px;
    background: var(--text-main);
    border-radius: 3px;
    transition: all 0.3s ease;
    display: block;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile Navigation Overlay - HIDDEN by default */
.mobile-nav-overlay {
    display: none !important;
    /* Force hidden until activated */
    visibility: hidden;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    z-index: 999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Only show when .active class is added by JavaScript */
.mobile-nav-overlay.active {
    display: flex !important;
    visibility: visible;
    opacity: 1;
}

.mobile-nav-overlay button {
    background: var(--bg-card) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: var(--text-main) !important;
    padding: 0.9rem 1.5rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 180px;
    text-align: left;
    font-family: var(--font-main);
}

.mobile-nav-overlay button:hover,
.mobile-nav-overlay button:active {
    background: var(--primary-gradient) !important;
    border-color: transparent !important;
    transform: scale(1.02);
}

.mobile-nav-overlay .close-mobile-nav {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    min-width: auto;
    padding: 0.5rem;
}

.mobile-nav-overlay .close-mobile-nav:hover {
    color: var(--text-main);
    background: transparent;
    transform: none;
}

/* Header with hamburger for mobile */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.app-header h1 {
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 5px;
        align-items: flex-start;
    }

    .container {
        padding: 1rem;
        margin-top: 0;
        border-radius: 12px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    h1 {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }

    /* Hide desktop nav, show hamburger */
    nav {
        display: none;
    }

    .hamburger-menu {
        display: flex;
    }

    nav button {
        flex-shrink: 0;
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    #dashboard-widgets {
        grid-template-columns: 1fr;
    }

    .user-summary-card,
    .widget-card,
    .bot-controls-container,
    .bot-summary {
        width: 100%;
        box-sizing: border-box;
    }

    .cryptos-table th,
    .cryptos-table td {
        padding: 0.8rem;
        font-size: 0.9rem;
    }

    #chat-container {
        width: 90%;
        right: 5%;
        bottom: 90px;
        height: 60vh;
    }

    #chat-bubble {
        bottom: 20px;
        right: 20px;
    }

    /* ===========================================
       RESPONSIVE TABLES - CARD LAYOUT FOR MOBILE
       =========================================== */

    /* Hide table header on mobile */
    .trades-table thead {
        display: none;
    }

    /* Transform table body into flex column of cards */
    .trades-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    /* Each row becomes a card */
    .trades-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        background: var(--bg-card);
        border-radius: 12px;
        padding: 12px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        gap: 8px;
    }

    /* Each cell adapts to card layout */
    .trades-table tbody td {
        display: flex;
        flex-direction: column;
        padding: 6px 8px;
        border: none;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 8px;
        min-width: calc(50% - 4px);
        box-sizing: border-box;
    }

    /* Add labels before content */
    .trades-table tbody td::before {
        content: attr(data-label);
        font-size: 10px;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 4px;
    }

    /* Symbol cell - full width, prominent */
    .trades-table tbody td:first-child {
        width: 100%;
        min-width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
        font-weight: 600;
        font-size: 1.1rem;
    }

    .trades-table tbody td:first-child::before {
        display: none;
    }

    /* P&L cell - highlighted */
    .trades-table tbody td:nth-child(5) {
        background: rgba(16, 185, 129, 0.1);
        font-weight: bold;
        font-size: 1rem;
    }

    /* Type badge styling in card mode */
    .trades-table tbody td:nth-child(2) {
        max-width: fit-content;
    }

    /* Metrics grid - 2 columns on mobile */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Summary grid adjustments */
    .summary-grid {
        grid-template-columns: 1fr !important;
    }

    /* Market Intel card - stack vertically */
    .market-intel-card>div[style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    /* ===========================================
       PORTFOLIO TABLE - CARD LAYOUT
       =========================================== */

    .portfolio-table thead {
        display: none;
    }

    .portfolio-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .portfolio-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        background: var(--bg-card);
        border-radius: 12px;
        padding: 12px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        gap: 8px;
    }

    .portfolio-table tbody td {
        display: flex;
        flex-direction: column;
        padding: 6px 8px;
        border: none;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 8px;
        min-width: calc(50% - 4px);
        box-sizing: border-box;
    }

    .portfolio-table tbody td::before {
        content: attr(data-label);
        font-size: 10px;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 4px;
    }

    /* Asset name - full width, prominent */
    .portfolio-table tbody td:first-child {
        width: 100%;
        min-width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.2) 100%);
        font-weight: 600;
        font-size: 1.1rem;
    }

    .portfolio-table tbody td:first-child::before {
        display: none;
    }

    /* ===========================================
       EQUITY CHART - MOBILE OPTIMIZATIONS
       =========================================== */

    .equity-chart-container {
        height: 220px !important;
        max-height: 220px !important;
        padding: 12px !important;
    }

    .equity-chart-container h4 {
        font-size: 13px !important;
        margin-bottom: 8px !important;
    }

    .equity-chart-container>div {
        height: 170px !important;
    }

    /* ===========================================
       FORMS & TOUCH CONTROLS - MOBILE OPTIMIZED
       =========================================== */

    /* Settings page - single column on mobile */
    .settings-content form>div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .settings-content .form-group[style*="grid-column: span 2"] {
        grid-column: span 1 !important;
    }

    /* Larger touch targets for inputs */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    select,
    textarea {
        min-height: 48px !important;
        font-size: 16px !important;
        /* Prevents zoom on iOS */
        padding: 12px !important;
        border-radius: 10px !important;
    }

    /* Larger buttons - minimum 44x44 touch target */
    button,
    .btn-primary,
    .btn-upgrade,
    .tab-btn {
        min-height: 44px !important;
        padding: 12px 16px !important;
        font-size: 14px !important;
    }

    /* Active/pressed state feedback */
    button:active,
    .btn-primary:active,
    .tab-btn:active {
        transform: scale(0.97) !important;
        opacity: 0.9 !important;
    }

    /* Toggle switches - larger for touch */
    .toggle-switch {
        min-width: 52px !important;
        min-height: 28px !important;
    }

    .toggle-switch::before {
        width: 24px !important;
        height: 24px !important;
    }

    /* Form labels - better visibility */
    label {
        font-size: 13px !important;
        margin-bottom: 6px !important;
        display: block !important;
    }

    /* Form groups - more spacing */
    .form-group {
        margin-bottom: 16px !important;
    }

    /* Settings sections spacing */
    .settings-section {
        margin-bottom: 24px !important;
        padding: 16px !important;
    }

    .settings-section h4 {
        font-size: 15px !important;
        margin-bottom: 16px !important;
    }

    /* API keys section - stacked */
    .api-keys-section .form-group {
        margin-bottom: 12px !important;
    }

    /* Subscription cards - full width */
    .subscription-card,
    .plan-card {
        width: 100% !important;
        margin-bottom: 12px !important;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .container {
        padding: 1rem;
        border-radius: 12px;
    }

    h1 {
        font-size: 1.6rem;
    }

    nav {
        gap: 0.5rem;
        padding: 0.8rem;
    }

    nav button {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }

    .widget-card {
        padding: 1rem;
    }

    .summary-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .portfolio-summary {
        flex-direction: column;
        text-align: center;
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }
}

/* Bot Monitor Styles */
.bot-controls-container {
    margin-bottom: 20px;
    padding: 1.5rem;
    border: var(--glass-border);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.4);
}

.monitor-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

.bot-summary {
    background: var(--bg-card-hover);
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    border: var(--glass-border);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* Settings Styles */
.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-section:last-child {
    border-bottom: none;
}

.plan-info-card {
    background: rgba(16, 185, 129, 0.1);
    /* Green tint */
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.settings-subsection {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.settings-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.info-box {
    background: rgba(59, 130, 246, 0.1);
    /* Blue tint */
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 1rem;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.info-note {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0;
    margin-top: 0.5rem;
}

/* Toggle Switch Override */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    margin-left: 10px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked+.slider {
    background-color: #6366f1;
}

input:focus+.slider {
    box-shadow: 0 0 1px #6366f1;
}

input:checked+.slider:before {
    -webkit-transform: translateX(24px);
    -ms-transform: translateX(24px);
    transform: translateX(24px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Portfolio Tabs */
.portfolio-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* Plan Cards */
.plan-card {
    background: var(--bg-card-hover);
    padding: 1.5rem;
    border-radius: 16px;
    border: var(--glass-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
    transition: transform 0.3s ease;
}

.plan-card:hover {
    transform: translateY(-5px);
    border-color: rgba(139, 92, 246, 0.5);
}

.plan-card h4 {
    margin-top: 0;
    color: var(--text-main);
    font-size: 1.2rem;
}

.plan-card .price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success-color);
    margin: 1rem 0;
}

.plan-card .description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.subscribe-btn {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.subscribe-btn.premium {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.subscribe-btn.free {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-muted);
}

.subscribe-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

/* Portfolio Styles */
.portfolio-summary {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 20px;
    background: var(--bg-card-hover);
    padding: 1.5rem;
    border-radius: 16px;
    border: var(--glass-border);
    box-shadow: var(--shadow-soft);
}

.portfolio-summary div {
    font-size: 1.1rem;
    color: var(--text-main);
}

.portfolio-summary strong {
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.portfolio-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
}

.portfolio-table th {
    background: rgba(15, 23, 42, 0.6);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.portfolio-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.portfolio-table tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Landing Mode Override */
body.landing-mode {
    background: #000;
    display: block;
    padding: 0;
}

body.landing-mode .container {
    max-width: 100%;
    width: 100%;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    backdrop-filter: none;
    border-radius: 0;
}

body.landing-mode .container>h1 {
    display: none;
}

/* Billing Styles */
.billing-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
}

.billing-table th {
    background: rgba(15, 23, 42, 0.6);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.billing-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.billing-table tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.view-invoice-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    background: var(--secondary-gradient);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.view-invoice-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.status-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.status-paid {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.status-pending {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.status-badge.status-failed {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* System Status Dashboard Styles */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.status-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 16px;
    border: var(--glass-border);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.status-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
}

.status-card h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.status-value {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.status-details {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Status Indicators (Border Colors) */
.status-card.status-ok {
    border-left: 4px solid var(--success-color);
}

.status-card.status-error {
    border-left: 4px solid #ef4444;
}

.status-card.status-warning {
    border-left: 4px solid #f59e0b;
}

.status-card.status-unknown {
    border-left: 4px solid #94a3b8;
}

/* Status Text Colors */
.text-ok {
    color: var(--success-color);
}

.text-error {
    color: #ef4444;
}

.text-warning {
    color: #f59e0b;
}

.text-unknown {
    color: #94a3b8;
}

.restart-btn {
    margin-top: 1rem;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.restart-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    transform: translateY(-2px);
}

/* ========================================
   Affiliates Page Styles
   ======================================== */

.affiliate-dashboard {
    width: 100%;
}

.affiliate-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 16px;
    border: var(--glass-border);
    margin-bottom: 1.5rem;
}

.affiliate-card h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.referral-link-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.referral-link-container input {
    flex: 1;
    min-width: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 16px;
    border: var(--glass-border);
    text-align: center;
}

.stat-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success-color);
}

.recent-referrals {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 16px;
    border: var(--glass-border);
}

.recent-referrals h3 {
    margin-top: 0;
    margin-bottom: 1rem;
}

/* Mobile Affiliates */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 1rem;
    }

    .referral-link-container {
        flex-direction: column;
    }

    .referral-link-container button {
        width: 100%;
    }
}

/* ========================================
   Loading States & Spinners
   ======================================== */

/* Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--text-main);
    animation: spin 0.8s ease-in-out infinite;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.spinner-primary {
    border-top-color: #6366f1;
}

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

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: inherit;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.05) 25%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text:last-child {
    width: 70%;
}

.skeleton-card {
    height: 100px;
    margin-bottom: 1rem;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Button Loading State */
button.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

button.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s ease-in-out infinite;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Loading Container */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
    gap: 1rem;
}

.loading-container .spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

/* Fade In Animation */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse Animation for status indicators */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}