/* ===== Base ===== */
html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    overflow-x: hidden;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #1a1a2e;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    min-height: 100vh;
    transition: transform 0.3s ease, width 0.3s ease;
    flex-shrink: 0;
    z-index: 1050;
}

.sidebar .nav-link {
    border-radius: 8px;
    margin-bottom: 4px;
    padding: 10px 14px;
    transition: background-color 0.2s;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    font-weight: 600;
}

/* ===== Sidebar overlay (mobile) ===== */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.sidebar-backdrop.show {
    display: block;
}

/* ===== Main content ===== */
.main-content {
    min-height: 100vh;
    background-color: #f0f2f5;
    min-width: 0;
}

/* ===== Top navbar ===== */
.top-navbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: #fff;
}

/* ===== Stat cards ===== */
.stat-card {
    border-radius: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* ===== Listing thumbnail ===== */
.listing-thumb {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
}

/* ===== Modern Table ===== */
.table {
    --bs-table-bg: transparent;
}

.table thead th {
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #8492a6;
    white-space: nowrap;
    border-bottom: 2px solid #e8ecf1 !important;
    border-top: none;
    padding: 14px 16px;
    background: transparent;
}

.table thead.table-light th {
    background: #fafbfc;
}

.table tbody td {
    vertical-align: middle;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f2f5;
    color: #3c4858;
    font-size: 0.875rem;
}

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

.table tbody tr:hover {
    background-color: #f7f9fc !important;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== Modern Badges ===== */
.badge {
    font-weight: 500;
    font-size: 0.72rem;
    padding: 5px 10px;
    border-radius: 6px;
    letter-spacing: 0.3px;
}

.badge.bg-success {
    background-color: #e6f9ed !important;
    color: #1b7a3d !important;
}

.badge.bg-danger {
    background-color: #fde8e8 !important;
    color: #c0392b !important;
}

.badge.bg-secondary {
    background-color: #eef0f4 !important;
    color: #5a6678 !important;
}

.badge.bg-warning {
    background-color: #fff7e0 !important;
    color: #b8860b !important;
}

.badge.bg-info {
    background-color: #e8f4fd !important;
    color: #1a6fb5 !important;
}

.badge.bg-primary {
    background-color: #e8eeff !important;
    color: #3b5bdb !important;
}

/* ===== Cards ===== */
.card {
    border-radius: 16px;
    overflow: hidden;
}

.card-header {
    border-radius: 16px 16px 0 0 !important;
    padding: 18px 20px;
}

.card-header h5 {
    font-weight: 600;
    font-size: 1.05rem;
    color: #1a1a2e;
}

/* ===== Action Buttons ===== */
.btn-action {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #e0e4ea;
    background: #fff;
    color: #5a6678;
    transition: all 0.15s ease;
    font-size: 0.85rem;
}

.btn-action:hover {
    background: #f7f9fc;
    border-color: #c8cdd5;
    color: #1a1a2e;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.btn-action.action-view { color: #3b5bdb; border-color: #d4dbf5; }
.btn-action.action-view:hover { background: #eef1ff; color: #2b4acb; }

.btn-action.action-listings { color: #1a6fb5; border-color: #c8e2f5; }
.btn-action.action-listings:hover { background: #e8f4fd; color: #155a94; }

.btn-action.action-toggle-on { color: #e67e22; border-color: #f5dfc8; }
.btn-action.action-toggle-on:hover { background: #fff7e0; color: #d35400; }

.btn-action.action-toggle-off { color: #1b7a3d; border-color: #c8e6d3; }
.btn-action.action-toggle-off:hover { background: #e6f9ed; color: #156b32; }

.btn-action.action-delete { color: #c0392b; border-color: #f0c8c8; }
.btn-action.action-delete:hover { background: #fde8e8; color: #a93226; }

.btn-action.action-link { color: #3b5bdb; border-color: #d4dbf5; }
.btn-action.action-link:hover { background: #eef1ff; color: #2b4acb; }

.action-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ===== User avatar ===== */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: #fff;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info-text .user-name {
    font-weight: 600;
    color: #1a1a2e;
    font-size: 0.875rem;
}

.user-info-text .user-username {
    font-size: 0.75rem;
    color: #8492a6;
}

/* ===== URL column ===== */
.url-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.url-cell .url-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #8492a6;
    font-size: 0.85rem;
}

.url-cell a {
    font-size: 0.82rem;
    color: #3b5bdb;
    font-weight: 500;
}

/* ===== Price tag ===== */
.price-tag {
    font-weight: 700;
    color: #1b7a3d;
    font-size: 0.9rem;
}

/* ===== Date display ===== */
.date-text {
    font-size: 0.82rem;
    color: #8492a6;
}

.date-text-primary {
    font-size: 0.82rem;
    color: #3c4858;
}

/* ===== Mono text (IDs) ===== */
.mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
    color: #8492a6;
    background: #f0f2f5;
    padding: 2px 6px;
    border-radius: 4px;
}

/* ===== DataTables modern ===== */
.dataTables_wrapper {
    padding: 0 4px;
}

.dataTables_wrapper .dataTables_filter {
    padding: 16px 16px 8px;
}

.dataTables_wrapper .dataTables_length {
    padding: 16px 16px 8px;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 10px;
    border: 1px solid #e0e4ea;
    padding: 8px 14px;
    font-size: 0.85rem;
    background: #fafbfc;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #3b5bdb;
    box-shadow: 0 0 0 3px rgba(59, 91, 219, 0.1);
    background: #fff;
    outline: none;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 10px;
    border: 1px solid #e0e4ea;
    padding: 6px 10px;
    font-size: 0.85rem;
    background: #fafbfc;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.8rem;
    color: #8492a6;
    padding: 12px 16px;
}

.dataTables_wrapper .dataTables_paginate {
    padding: 8px 16px 12px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 8px !important;
    border: none !important;
    padding: 6px 12px !important;
    margin: 0 2px !important;
    font-size: 0.82rem;
    color: #3c4858 !important;
    background: transparent !important;
    transition: all 0.15s;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f0f2f5 !important;
    color: #1a1a2e !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #3b5bdb !important;
    color: #fff !important;
    font-weight: 600;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #c8cdd5 !important;
}

/* ===== Empty state ===== */
.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: #8492a6;
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.9rem;
    margin: 0;
}

/* ===== Links ===== */
a {
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    text-decoration: none;
}

.cursor-pointer {
    cursor: pointer;
}

/* ===== Bottom nav (mobile) ===== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: #fff;
    border-top: 1px solid #e8ecf1;
    padding: 6px 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
}

.bottom-nav .nav {
    display: flex;
    justify-content: space-around;
}

.bottom-nav .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.7rem;
    color: #8492a6;
    padding: 4px 8px;
    gap: 2px;
}

.bottom-nav .nav-link i {
    font-size: 1.25rem;
}

.bottom-nav .nav-link.active {
    color: #3b5bdb;
    font-weight: 600;
}

/* ========================================
   RESPONSIVE — Tablet (< 992px)
   ======================================== */
@media (max-width: 991.98px) {
    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }
}

/* ========================================
   RESPONSIVE — Mobile (< 768px)
   ======================================== */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

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

    .bottom-nav {
        display: block;
    }

    .main-content {
        padding-bottom: 72px !important;
    }

    .container-fluid {
        padding: 16px !important;
    }

    .stat-card .card-body {
        padding: 12px;
    }

    .stat-card h3 {
        font-size: 1.5rem;
    }

    .stat-card h6 {
        font-size: 0.75rem;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .table tbody td,
    .table thead th {
        padding: 10px 10px;
    }

    .table {
        font-size: 0.82rem;
    }

    .table thead th {
        font-size: 0.65rem;
    }

    .listing-thumb {
        width: 48px;
        height: 36px;
        border-radius: 6px;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: left !important;
        margin-bottom: 8px;
        padding: 12px 12px 4px !important;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        text-align: center !important;
        margin-top: 8px;
        font-size: 0.8rem;
    }

    .card-header h5 {
        font-size: 1rem;
    }

    .top-navbar {
        padding: 8px 12px !important;
    }

    .text-truncate {
        max-width: 180px !important;
    }

    .dl-horizontal dt,
    .dl-horizontal dd {
        width: 100%;
        padding: 0;
    }

    .user-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
        border-radius: 8px;
    }

    .btn-action {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .action-group {
        gap: 4px;
    }

    .user-info-text .user-name {
        font-size: 0.8rem;
    }

    .user-info-text .user-username {
        font-size: 0.68rem;
    }
}

/* ========================================
   RESPONSIVE — Small phone (< 576px)
   ======================================== */
@media (max-width: 575.98px) {
    .stat-card h3 {
        font-size: 1.3rem;
    }

    .stat-icon {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }

    .container-fluid {
        padding: 12px !important;
    }

    .table {
        font-size: 0.78rem;
    }

    .listing-thumb {
        width: 40px;
        height: 30px;
    }

    .text-truncate {
        max-width: 120px !important;
    }
}
