:root {
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --primary-color: #111827;
    --primary-gradient: linear-gradient(135deg, #111827 0%, #374151 100%);
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
    width: 100%;
}

/* Mobile Sidebar Backdrop Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 999;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-close-btn {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.brand {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-primary);
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
    overflow-y: auto;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.nav-item a:hover {
    color: var(--text-primary);
    background-color: var(--bg-primary);
    border-color: var(--border-color);
}

.nav-item.active a {
    color: var(--text-primary);
    background-color: var(--bg-primary);
    border-color: var(--text-primary);
    font-weight: 700;
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Main Workspace */
.main-wrapper {
    flex-grow: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    transition: margin-left 0.3s ease;
}

/* Header */
.main-header {
    height: 70px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.wallet-badge {
    background-color: var(--text-primary);
    color: var(--bg-secondary);
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* Content Container */
.content-body {
    padding: 30px 40px;
    flex-grow: 1;
    min-width: 0;
}

/* Cards & Grid */
.grid-cols-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stats-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stats-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stats-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Auth Cards */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-primary);
    padding: 16px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 32px 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Forms & UI Controls */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    border-color: var(--text-primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: var(--bg-secondary);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.btn:hover {
    background-color: #000000;
}

.btn-secondary {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
    border-color: var(--text-primary);
}

.btn-danger {
    background-color: var(--danger-color);
    color: #fff;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Tables */
.table-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.table-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 600px;
}

.custom-table th, .custom-table td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    white-space: nowrap;
}

.custom-table th {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-table tr:hover td {
    background-color: rgba(0, 0, 0, 0.015);
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-success {
    background-color: rgba(5, 150, 105, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.badge-danger {
    background-color: rgba(220, 38, 38, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.badge-pending {
    background-color: rgba(217, 119, 6, 0.1);
    color: var(--warning-color);
    border: 1px solid rgba(217, 119, 6, 0.2);
}

.badge-secondary {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background-color: rgba(5, 150, 105, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.alert-danger {
    background-color: rgba(220, 38, 38, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    padding: 16px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px 24px;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Buy Page & Panels */
.buy-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
}

.selection-panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.orders-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.activation-item {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activation-item.status-received {
    border-left: 4px solid var(--success-color);
}

.activation-item.status-pending {
    border-left: 4px solid var(--warning-color);
}

.operator-pill {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    background-color: var(--bg-primary);
}

.operator-pill:hover {
    border-color: var(--text-primary);
}

.operator-pill.active {
    border-color: var(--text-primary);
    background-color: #fff;
    box-shadow: var(--shadow-sm);
    font-weight: 700;
}

/* Code documentation */
.doc-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.doc-endpoint {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: monospace;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 12px;
    word-break: break-all;
    max-width: 100%;
}

.endpoint-method {
    background-color: var(--text-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--bg-secondary);
}

/* Popular Promotional Services (Image Style List Cards) */
.popular-services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.popular-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.popular-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--text-primary);
}

.popular-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.popular-flag-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 18px;
    height: 13px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    border: 1px solid #ffffff;
}

.popular-info {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.popular-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.3px;
}

.popular-sub {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.server-badge {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-primary);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    border: 1px solid var(--border-color);
}

.promo-tag-badge {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid transparent;
    line-height: 1;
    display: inline-block;
}

.operator-card {
    background-color: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.operator-card:hover {
    border-color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.operator-card.selected {
    border-color: var(--text-primary);
    background-color: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.popular-buy-btn {
    background: #1e293b;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    text-decoration: none;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}

.popular-buy-btn:hover {
    background: #0f172a;
}

.popular-buy-btn .price-text {
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
}

.popular-buy-btn .buy-text {
    font-size: 10px;
    font-weight: 600;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1px;
}

pre {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    color: var(--text-primary);
    font-size: 13px;
}

/* Mobile Toggle Hamburger button */
.mobile-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 16px;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* Responsive Breakpoints */
@media (max-width: 1080px) {
    .buy-grid {
        grid-template-columns: 1fr;
    }
    .grid-dashboard-2col {
        grid-template-columns: 1fr !important;
    }
    .grid-docs-2col {
        grid-template-columns: 1fr !important;
    }
    .grid-wallet-2col {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .sidebar-close-btn {
        display: flex;
    }
    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .mobile-toggle {
        display: inline-flex;
    }
    .main-header {
        padding: 0 16px;
        height: 60px;
    }
    .header-title {
        font-size: 16px;
    }
    .user-info-text {
        display: none !important;
    }
    .wallet-badge {
        padding: 6px 10px;
        font-size: 12px;
    }
    .content-body {
        padding: 16px;
    }
    .grid-cols-4 {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }
    .stats-card {
        padding: 14px;
    }
    .stats-value {
        font-size: 18px;
    }
    .modal-content {
        padding: 20px 16px;
        width: 95%;
        border-radius: 12px;
    }
    .custom-table th, .custom-table td {
        padding: 10px 12px;
    }
    .activation-card-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
}

@media (max-width: 480px) {
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
}
