/* ==========================================================
   Sheba API Market — Global Stylesheet
   Mobile + Desktop Responsive Design
   ========================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: #f0f2f8;
    color: #2d3748;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    padding-bottom: 80px;
}

a { text-decoration: none; color: inherit; }

/* ==================== Topbar ==================== */
.topbar {
    background: #ffffff;
    padding: 14px 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid #eef0f5;
}

.topbar .brand {
    font-weight: 800;
    font-size: 18px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar .brand i {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 22px;
}

.topbar .user-area {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #555;
}

.topbar .avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 15px;
}

/* ==================== Layout ==================== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: #1a2332;
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 500;
    transition: transform 0.3s ease;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.sidebar .brand {
    padding: 22px 20px;
    font-size: 17px;
    font-weight: 800;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar .brand i {
    font-size: 22px;
    background: linear-gradient(135deg, #667eea, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar .nav-section {
    font-size: 10px;
    text-transform: uppercase;
    padding: 16px 20px 6px;
    color: rgba(255,255,255,0.35);
    letter-spacing: 1.2px;
    font-weight: 700;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.72);
    padding: 11px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar .nav-link i { font-size: 17px; width: 20px; }
.sidebar .nav-link:hover { background: rgba(255,255,255,0.05); color: white; }

.sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(102,126,234,0.25), transparent);
    color: white;
    border-left-color: #667eea;
}

.main-area { flex: 1; margin-left: 240px; min-height: 100vh; }
.content { padding: 25px; max-width: 1400px; }

/* ==================== Page Header ==================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    color: #1a202c;
}

.page-header p {
    color: #718096;
    font-size: 14px;
    margin: 4px 0 0;
}

/* ==================== Cards ==================== */
.card-box {
    background: #fff;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    margin-bottom: 20px;
    border: 1px solid #eef0f5;
}

.card-box h5 {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 15px;
    color: #1a202c;
}

/* ==================== Stats Grid ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    border: 1px solid #eef0f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.25s;
}

.stat-card:hover { transform: translateY(-4px); }

.stat-card .label {
    font-size: 12px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 700;
}

.stat-card .value {
    font-size: 26px;
    font-weight: 800;
    margin: 4px 0 0;
    color: #1a202c;
}

.stat-card .icon-box {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.icon-purple { background: #f3e8ff; color: #7c3aed; }
.icon-green  { background: #dcfce7; color: #16a34a; }
.icon-blue   { background: #dbeafe; color: #2563eb; }
.icon-orange { background: #fed7aa; color: #ea580c; }

/* ==================== API Cards ==================== */
.api-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.api-card {
    background: #fff;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    border: 1.5px solid #eef0f5;
    transition: all 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.api-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(102,126,234,0.15);
    border-color: #667eea;
}

.api-card .api-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 14px;
}

.api-card h5 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #1a202c;
}

.api-card p {
    font-size: 13.5px;
    color: #718096;
    margin-bottom: 14px;
    flex: 1;
}

.api-card .price-tag {
    display: inline-block;
    background: #e0e7ff;
    color: #4338ca;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 14px;
    width: fit-content;
}

.api-card .category-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 10px;
    padding: 3px 9px;
    background: #f0f0f5;
    border-radius: 6px;
    color: #666;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ==================== Buttons ==================== */
.btn {
    border-radius: 9px;
    font-weight: 600;
    padding: 9px 18px;
    font-size: 14px;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.btn-gradient {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 14px rgba(102,126,234,0.3);
}

.btn-gradient:hover {
    color: white;
    box-shadow: 0 6px 20px rgba(102,126,234,0.45);
    transform: translateY(-2px);
}

.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ==================== Tables ==================== */
.table-wrap {
    background: #fff;
    border-radius: 14px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    border: 1px solid #eef0f5;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f8f9fc;
    color: #4a5568;
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #4a5568;
    border-bottom: 1px solid #eef0f5;
}

.data-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid #f1f3f9;
    color: #2d3748;
}

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

/* ==================== Badges ==================== */
.badge-soft {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 16px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.badge-green { background: #dcfce7; color: #166534; }
.badge-red   { background: #fee2e2; color: #991b1b; }
.badge-blue  { background: #dbeafe; color: #1e40af; }
.badge-gray  { background: #f1f3f9; color: #4a5568; }
.badge-orange{ background: #fed7aa; color: #9a3412; }

/* ==================== Forms ==================== */
.form-label {
    font-weight: 600;
    font-size: 13px;
    color: #4a5568;
    margin-bottom: 6px;
    display: block;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    background: #fff;
    color: #2d3748;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102,126,234,0.1);
}

/* ==================== Modal ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 15px;
}

.modal-overlay.active { display: flex; }

.modal-box {
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 500px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 30px 80px rgba(0,0,0,0.4);
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(25px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-box .modal-head {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 5;
}

.modal-box .modal-head h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-box .close-x {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    opacity: 0.85;
}

.modal-box .close-x:hover { opacity: 1; }

.modal-body { padding: 22px; }

/* ==================== Tabs ==================== */
.balance-tabs {
    display: flex;
    gap: 6px;
    padding: 5px;
    background: #f3f4f9;
    border-radius: 11px;
    margin-bottom: 18px;
}

.balance-tabs button {
    flex: 1;
    border: none;
    background: transparent;
    padding: 9px 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.balance-tabs button.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(102,126,234,0.15);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ==================== Alerts ==================== */
.alert-box {
    padding: 13px 18px;
    border-radius: 11px;
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success { background: #dcfce7; color: #166534; border-left: 4px solid #22c55e; }
.alert-danger  { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid #3b82f6; }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid #f59e0b; }

/* ==================== Empty State ==================== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #94a3b8;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 14px;
    display: block;
    opacity: 0.5;
}

.empty-state p { font-size: 15px; margin-bottom: 14px; }

/* ==================== Mobile Bottom Nav ==================== */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    z-index: 950;
    padding: 8px 4px;
    border-top: 1px solid #eef0f5;
}

.mobile-nav .nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 4px;
    color: #94a3b8;
    font-size: 10.5px;
    font-weight: 600;
    transition: color 0.2s;
    text-align: center;
}

.mobile-nav .nav-item i {
    font-size: 20px;
}

.mobile-nav .nav-item.active {
    color: #667eea;
}

/* ==================== Sidebar Overlay ==================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 490;
}

.sidebar-overlay.active { display: block; }

/* ==================== Responsive ==================== */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 50px rgba(0,0,0,0.4);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-area {
        margin-left: 0;
    }

    .content {
        padding: 16px;
    }

    .mobile-nav {
        display: block;
    }

    body {
        padding-bottom: 85px;
    }

    .page-header h1 { font-size: 20px; }
    .stat-card .value { font-size: 22px; }

    .data-table th,
    .data-table td {
        padding: 11px 10px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .topbar { padding: 12px 14px; }
    .topbar .brand { font-size: 16px; }
    .topbar .brand .full-text { display: none; }
    .content { padding: 12px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-card .value { font-size: 18px; }
    .stat-card .icon-box { width: 42px; height: 42px; font-size: 20px; }
    .modal-box .modal-body { padding: 16px; }
}