/* ============================================
   Shopee Order Manager — Premium Dark Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-glass: rgba(22, 33, 62, 0.85);
    --accent-primary: #e94560;
    --accent-secondary: #0f3460;
    --accent-success: #00d2a0;
    --accent-warning: #ffb830;
    --accent-info: #4da8ff;
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6c6c85;
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-glow: 0 0 30px rgba(233, 69, 96, 0.15);
    --gradient-primary: linear-gradient(135deg, #e94560, #c93558);
    --gradient-secondary: linear-gradient(135deg, #0f3460, #162860);
    --gradient-success: linear-gradient(135deg, #00d2a0, #00b089);
    --radius: 14px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background particles */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(233, 69, 96, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(15, 52, 96, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(0, 210, 160, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ============ HEADER ============ */
.app-header {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo .logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-glow);
}

.app-logo h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff, #a0a0b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ============ SHOP SELECTOR ============ */
.shop-selector {
    position: relative;
}

.shop-selector select {
    appearance: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 42px 10px 16px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    min-width: 180px;
}

.shop-selector select:hover,
.shop-selector select:focus {
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15);
}

.shop-selector::after {
    content: '▾';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
    font-size: 12px;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px;
}

/* ============ TOOLBAR ============ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Tab Pills */
.tab-pills {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 4px;
    border: 1px solid var(--border-color);
}

.tab-pill {
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

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

.tab-pill.active {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(233, 69, 96, 0.3);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}

.badge-count {
    background: rgba(233, 69, 96, 0.2);
    color: var(--accent-primary);
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 2px 12px rgba(233, 69, 96, 0.25);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(233, 69, 96, 0.4);
}

.btn-success {
    background: var(--gradient-success);
    color: #fff;
    box-shadow: 0 2px 12px rgba(0, 210, 160, 0.25);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 210, 160, 0.4);
}

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

.btn-outline:hover:not(:disabled) {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(233, 69, 96, 0.06);
}

.btn-info {
    background: linear-gradient(135deg, #4da8ff, #3d8ee6);
    color: #fff;
    box-shadow: 0 2px 12px rgba(77, 168, 255, 0.25);
}

.btn-info:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(77, 168, 255, 0.4);
}

.btn-icon {
    font-size: 16px;
    line-height: 1;
}

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

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

.stat-card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

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

.stat-icon.pending { background: rgba(255, 184, 48, 0.12); }
.stat-icon.shipped { background: rgba(0, 210, 160, 0.12); }
.stat-icon.selected { background: rgba(77, 168, 255, 0.12); }
.stat-icon.date { background: rgba(233, 69, 96, 0.12); }

.stat-info h3 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============ TABLE ============ */
.table-container {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
}

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

thead {
    background: rgba(255, 255, 255, 0.03);
}

thead th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

tbody tr {
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

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

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

tbody tr.selected {
    background: rgba(233, 69, 96, 0.06);
}

tbody td {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    vertical-align: middle;
}

/* Checkbox */
.checkbox-cell {
    width: 44px;
    text-align: center;
}

.custom-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    accent-color: var(--accent-primary);
}

.custom-checkbox:checked {
    border-color: var(--accent-primary);
}

/* Order SN */
.order-sn {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.status-ready {
    background: rgba(255, 184, 48, 0.12);
    color: var(--accent-warning);
}

.status-processed {
    background: rgba(0, 210, 160, 0.12);
    color: var(--accent-success);
}

.carrier-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(77, 168, 255, 0.1);
    color: var(--accent-info);
}

/* Items tooltip */
.items-preview {
    max-width: 200px;
}

.items-preview .item-line {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.items-preview .item-line + .item-line {
    margin-top: 2px;
}

.amount {
    font-weight: 600;
    color: var(--accent-success);
}

/* ============ LOADING ============ */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 26, 0.8);
    backdrop-filter: blur(4px);
    z-index: 999;
    align-items: center;
    justify-content: center;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-text {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

/* ============ TOAST ============ */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
    font-size: 13px;
}

.toast.success { border-left: 3px solid var(--accent-success); }
.toast.error { border-left: 3px solid var(--accent-primary); }
.toast.info { border-left: 3px solid var(--accent-info); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
    color: var(--text-muted);
}

/* ============ SELECT ALL ============ */
.select-all-row {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .app-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .main-content {
        padding: 16px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left,
    .toolbar-right {
        flex-wrap: wrap;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .btn {
        padding: 8px 14px;
        font-size: 12px;
    }
}

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

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ============ REFRESH BTN ANIM ============ */
.btn-refresh .btn-icon {
    transition: transform 0.5s ease;
}

.btn-refresh.loading .btn-icon {
    animation: spin 0.8s linear infinite;
}
