/* ===== CSS Variables & Reset ===== */
:root {
    --bg-primary: #030712;
    --bg-secondary: #081120;
    --bg-card: #081120;
    --bg-card-hover: #0c182e;
    --bg-input: #0c182e;
    --border: rgba(0, 242, 254, 0.28);
    --border-glow: 0 0 20px rgba(0, 242, 254, 0.18);
    --border-focus: #00f2fe;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #00f2fe;
    --accent-hover: #38bdf8;
    --accent-glow: rgba(0, 242, 254, 0.4);
    --accent-gradient: linear-gradient(135deg, #00f2fe 0%, #0ea5e9 100%);
    --cyan: #00f2fe;
    --cyan-glow: rgba(0, 242, 254, 0.35);
    --gold: #facc15;
    --gold-glow: rgba(250, 204, 21, 0.35);
    --success: #10b981;
    --warning: #facc15;
    --danger: #ef4444;
    --info: #0ea5e9;
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
    --radius: 14px;
    --radius-sm: 8px;
    --transition: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { font-size: 15px; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(circle at 50% -10%, rgba(0, 242, 254, 0.12), transparent 45%),
        radial-gradient(circle at 100% 100%, rgba(14, 165, 233, 0.08), transparent 40%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

/* ===== Login Screen ===== */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a3e 50%, #0f0f1a 100%);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.login-logo {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.login-card h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.login-card input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: border-color var(--transition);
}

.login-card input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-card button {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.login-card button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.error-msg {
    color: var(--danger);
    margin-top: 0.8rem;
    font-size: 0.85rem;
}

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

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: width var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    align-items: center;
    padding: 1.2rem 1rem;
    border-bottom: 1px solid var(--border);
    gap: 0.6rem;
}

.logo {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.logo-text {
    font-weight: 700;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    margin-left: auto;
}

.nav-list {
    list-style: none;
    padding: 0.5rem 0.5rem;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
    margin-bottom: 2px;
    user-select: none;
}

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

.nav-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.05));
    color: var(--accent);
    font-weight: 600;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.nav-icon { font-size: 1.15rem; flex-shrink: 0; }
.nav-label { white-space: nowrap; font-size: 0.92rem; }

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    transition: margin-left var(--transition);
    min-height: 100vh;
}

.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border);
}

/* ===== Status Cards ===== */
.status-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.status-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%), var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.status-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.status-indicator.online {
    background: var(--success);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.7);
    position: relative;
}

.status-indicator.online::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid rgba(16, 185, 129, 0.6);
    animation: radarPulse 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes radarPulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2.2); opacity: 0; }
}

.status-indicator.offline { background: var(--danger); box-shadow: 0 0 8px rgba(239, 68, 68, 0.5); }
.status-indicator.reconnecting {
    background: var(--warning);
    animation: radarPulse 1.2s infinite;
}

.status-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.status-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.status-value {
    font-size: 1.25rem;
    font-weight: 800;
    display: block;
    letter-spacing: -0.3px;
    color: #fff;
}

/* ===== Toggle Switch ===== */
.toggle-switch {
    position: relative;
    margin-left: auto;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-slider {
    display: block;
    width: 48px;
    height: 26px;
    background: var(--border);
    border-radius: 13px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* ===== Section Block ===== */
.section-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.6), 0 0 18px rgba(0, 242, 254, 0.08);
}

.section-block h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== Buttons ===== */
.btn {
    padding: 0.55rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-primary {
    background: linear-gradient(135deg, #00f2fe 0%, #0ea5e9 100%);
    color: #030712;
    font-weight: 800;
    box-shadow: 0 0 18px rgba(0, 242, 254, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 28px rgba(0, 242, 254, 0.55);
}

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

.btn-secondary:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.82rem; }

.btn-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.9rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color var(--transition);
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input[type="color"] {
    width: 60px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    cursor: pointer;
    padding: 2px;
}

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-glow);
}

.input-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

.input-row input, .input-row select {
    flex: 1;
    min-width: 100px;
}

.input-row label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.radio-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.radio-option input[type="radio"] {
    width: auto;
    accent-color: var(--accent);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    accent-color: var(--accent);
}

/* ===== Data Table ===== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
}

.table-hint {
    display: none;
}

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

.data-table th {
    text-align: left;
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.6rem 0.8rem;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(42, 42, 74, 0.5);
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

/* ===== Groups ===== */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.group-list, .blacklist-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.group-item, .blacklist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.9rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.group-item:hover, .blacklist-item:hover {
    border-color: var(--accent);
}

.group-info {
    flex: 1;
}

.group-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.group-id {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

.group-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

/* ===== Image Settings ===== */
.image-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.preview-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.preview-box img {
    max-width: 100%;
    border-radius: var(--radius-sm);
}

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

/* ===== Pending Batches ===== */
.pending-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pending-batch {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
    transition: transform var(--transition), border-color var(--transition);
}

.pending-batch:hover {
    border-color: rgba(99, 102, 241, 0.5);
}

.pending-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(42, 42, 74, 0.5);
}

.pending-sender {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pending-time {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 12px;
}

.pending-items-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pending-item-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
}

.pending-thumb-box {
    position: relative;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.pending-thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.pending-thumb-box:hover img {
    transform: scale(1.1);
}

.pending-thumb-zoom {
    position: absolute;
    bottom: 3px;
    right: 3px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    color: #38bdf8;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    pointer-events: none;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.pending-item-info {
    flex: 1;
    min-width: 0;
}

.pending-price-flow {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.price-pill-old {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.price-arrow {
    color: var(--accent);
    font-weight: 800;
    font-size: 1.1rem;
}

.price-pill-new {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(6, 182, 212, 0.15));
    border: 1px solid rgba(16, 185, 129, 0.45);
    color: #34d399;
    padding: 4px 12px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.25);
}

.price-markup-badge {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #a5b4fc;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
}

.pending-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-approve-lg {
    flex: 2;
    min-height: 48px;
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    transition: all var(--transition);
}

.btn-approve-lg:hover {
    filter: brightness(1.12);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.btn-approve-lg:active {
    transform: scale(0.97);
}

.btn-skip-lg {
    flex: 1;
    min-height: 48px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: #fca5a5;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all var(--transition);
}

.btn-skip-lg:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fff;
}

.btn-skip-lg:active {
    transform: scale(0.97);
}

/* ===== QR Container ===== */
.qr-container {
    margin-top: 1rem;
    text-align: center;
}

.qr-container img {
    max-width: 250px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
}

.qr-container p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* ===== Filter Row ===== */
.filter-row {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-row select, .filter-row input {
    flex: 1;
    min-width: 140px;
}

/* ===== Status Badges ===== */
.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-posted { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-skipped { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-error { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-pending { background: rgba(59, 130, 246, 0.15); color: var(--info); }

/* ===== Preview Result ===== */
.preview-result {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent);
    min-width: 120px;
}

/* ===== Scanned Groups ===== */
.scanned-groups {
    margin-top: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.scanned-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid rgba(42, 42, 74, 0.5);
}

/* ===== Utility ===== */
.mt-16 { margin-top: 1rem; }
.empty-msg { color: var(--text-muted); font-style: italic; font-size: 0.9rem; }
.hint { color: var(--text-muted); font-size: 0.83rem; margin-bottom: 0.8rem; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Toast Notification ===== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: white;
    animation: slideIn 0.3s ease;
    max-width: 350px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }

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

/* ===== Mobile Header ===== */
.mobile-header {
    display: none;
}

/* ===== Bottom Nav ===== */
.bottom-nav {
    display: none;
}

/* ===== Image Modal / Lightbox ===== */
.image-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-wrapper {
    position: relative;
    z-index: 1;
    max-width: 96vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-close-btn {
    align-self: flex-end;
    margin-bottom: 0.5rem;
    padding: 0.45rem 1.1rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.modal-wrapper img {
    max-width: 100%;
    max-height: 82vh;
    border-radius: var(--radius);
    object-fit: contain;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
    border: 1px solid var(--border);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== Desktop / Mobile Visibility Helpers ===== */
.desktop-only {
    display: block;
}
.mobile-only {
    display: none;
}

/* ===== Page Header Flex & Filter Toggle ===== */
.page-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}

.page-header-flex .page-title {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
}

.filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
}

.filter-toggle-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.filter-arrow {
    font-size: 0.65rem;
    transition: transform var(--transition);
}

/* ===== Collapsible Filter Dropdown Panel ===== */
.filter-dropdown-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    margin-bottom: 1.2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    animation: slideDownFilter 0.2s ease-out;
}

@keyframes slideDownFilter {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: flex-end;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ===== Mobile Log Cards & Dropdown (Accordion) ===== */
.logs-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.log-mobile-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: all var(--transition);
    border-left: 3px solid var(--accent);
}

.log-mobile-card:active {
    background: var(--bg-card-hover);
}

.lmc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.lmc-left {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.lmc-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.lmc-sender {
    font-size: 0.92rem;
    color: var(--text-primary);
}

.lmc-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.lmc-price {
    font-size: 1rem;
    font-weight: 700;
    color: #38bdf8;
}

.lmc-status-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.lmc-caret {
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform var(--transition);
}

/* Accordion Dropdown Details */
.lmc-details {
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(10, 10, 22, 0.4);
    animation: fadeIn 0.2s ease;
}

.lmc-detail-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}

.lmc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
}

.lmc-lbl {
    color: var(--text-muted);
}

.lmc-val {
    font-weight: 500;
    color: var(--text-primary);
}

.lmc-val.highlight {
    color: #38bdf8;
    font-weight: 700;
}

.lmc-val.profit {
    color: #4ade80;
    font-weight: 600;
}

.lmc-actions {
    margin-top: 0.6rem;
}

/* ===== Log Detail Popup Modal ===== */
.log-detail-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 480px;
    margin: auto;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    animation: popIn 0.25s ease;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.05rem;
    margin: 0;
}

.modal-body {
    padding: 1.2rem;
}

.popup-detail-card {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.popup-status-badge {
    display: flex;
    justify-content: center;
    margin-bottom: 0.3rem;
}

.popup-detail-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.popup-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.88rem;
}

.popup-detail-item .label {
    color: var(--text-muted);
}

.popup-detail-item .value {
    color: var(--text-primary);
    font-weight: 500;
}

/* ===== Mobile Responsive (< 768px) ===== */
@media (max-width: 768px) {
    .dashboard {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        overflow-x: hidden !important;
    }

    /* Hide desktop sidebar on mobile */
    .sidebar {
        display: none !important;
    }
    .mobile-menu-btn {
        display: none !important;
    }

    /* Main Content spans full width */
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    /* Mobile Header on top */
    .mobile-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        position: sticky !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        z-index: 500 !important;
        background: rgba(7, 10, 19, 0.85) !important;
        backdrop-filter: blur(24px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        padding: 0.75rem 1rem !important;
    }

    .mheader-left {
        display: flex;
        align-items: center;
        gap: 0.65rem;
    }

    .mheader-logo {
        font-size: 1.4rem;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(56, 189, 248, 0.2));
        border: 1px solid rgba(99, 102, 241, 0.4);
        border-radius: 10px;
        box-shadow: 0 0 16px rgba(99, 102, 241, 0.3);
    }

    .mheader-title {
        display: flex;
        flex-direction: column;
    }

    .mheader-name {
        font-weight: 800;
        font-size: 0.98rem;
        letter-spacing: -0.2px;
        background: linear-gradient(135deg, #ffffff 0%, #38bdf8 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .mheader-status {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.75rem;
        color: var(--text-secondary);
        font-weight: 500;
    }

    .status-indicator-sm {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--danger);
        display: inline-block;
    }
    .status-indicator-sm.online {
        background: #10b981;
        box-shadow: 0 0 10px #10b981;
        position: relative;
    }
    .status-indicator-sm.online::after {
        content: "";
        position: absolute;
        inset: -3px;
        border-radius: 50%;
        border: 2px solid rgba(16, 185, 129, 0.65);
        animation: radarPulse 2s cubic-bezier(0, 0, 0.2, 1) infinite;
    }
    .status-indicator-sm.reconnecting {
        background: var(--warning);
    }

    .mheader-right {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.07);
        border-radius: 20px;
        padding: 3px 8px 3px 10px;
    }

    .mheader-mode-label {
        font-size: 0.78rem;
        font-weight: 700;
        color: var(--text-secondary);
    }

    /* Pages have inner padding and space for bottom nav */
    .page {
        padding: 1rem 0.85rem !important;
        padding-bottom: 95px !important; /* Space for bottom nav */
        box-sizing: border-box !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .page-title {
        font-size: 1.35rem;
        font-weight: 800;
        letter-spacing: -0.3px;
        margin-bottom: 1rem;
    }

    /* Status Cards: Compact 2x2 grid */
    .status-cards {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        margin-bottom: 1rem !important;
    }

    .status-card {
        padding: 0.9rem !important;
        border-radius: var(--radius-sm);
        background: linear-gradient(145deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%), rgba(17, 24, 39, 0.75);
    }

    .status-card .status-icon {
        font-size: 1.4rem;
    }

    .status-card .status-value {
        font-size: 1.3rem;
        font-weight: 800;
    }

    /* Bottom Navigation Bar (Dock) */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 68px;
        padding-bottom: env(safe-area-inset-bottom, 0);
        background: rgba(8, 17, 32, 0.94);
        backdrop-filter: blur(28px) saturate(200%);
        -webkit-backdrop-filter: blur(28px) saturate(200%);
        border-top: 1px solid rgba(0, 242, 254, 0.28);
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 242, 254, 0.1);
    }

    .bnav-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: var(--text-secondary);
        padding: 6px 0;
        font-size: 0.72rem;
        font-weight: 600;
        cursor: pointer;
        position: relative;
        transition: all var(--transition);
        -webkit-tap-highlight-color: transparent;
    }

    .bnav-btn:active {
        transform: scale(0.9);
    }

    .bnav-icon {
        font-size: 1.45rem;
        margin-bottom: 3px;
        transition: transform var(--transition);
    }

    .bnav-btn.active {
        color: #00f2fe;
        font-weight: 800;
        text-shadow: 0 0 12px rgba(0, 242, 254, 0.6);
    }

    .bnav-btn.active::after {
        content: "";
        position: absolute;
        bottom: 4px;
        width: 20px;
        height: 3px;
        border-radius: 3px;
        background: #00f2fe;
        box-shadow: 0 0 12px #00f2fe, 0 0 20px #0ea5e9;
    }

    .bnav-btn.active .bnav-icon {
        transform: translateY(-2px) scale(1.15);
    }

    .bnav-badge {
        position: absolute;
        top: 4px;
        right: 20%;
        background: #ef4444;
        color: white;
        font-size: 0.65rem;
        font-weight: 800;
        min-width: 17px;
        height: 17px;
        border-radius: 9px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 4px;
        border: 2px solid #030712;
        box-shadow: 0 0 12px rgba(239, 68, 68, 0.8);
        animation: pulseBadge 1.8s infinite;
    }

    @keyframes pulseBadge {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.18); }
    }

    /* Inputs & Form controls on mobile */
    input[type="text"],
    input[type="number"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents iOS Safari auto-zoom */
        padding: 0.75rem !important;
    }

    .input-row {
        flex-direction: column !important;
        gap: 0.6rem !important;
    }

    .input-row input, .input-row select, .input-row button {
        width: 100% !important;
        min-width: 100% !important;
    }

    .groups-grid,
    .image-settings-grid {
        grid-template-columns: 1fr !important;
    }

    .section-block {
        padding: 1rem !important;
        border-radius: var(--radius-sm);
        margin-bottom: 1rem;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    /* Responsive Data Tables */
    .table-hint {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 0.75rem;
        color: var(--accent);
        margin-top: 0.8rem;
        margin-bottom: 0.4rem;
        font-weight: 500;
    }

    .table-responsive {
        margin: 0.3rem 0 0.5rem 0;
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: var(--radius-sm);
        background: rgba(10, 10, 22, 0.5);
    }

    .table-responsive::-webkit-scrollbar {
        height: 4px;
    }

    .table-responsive::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.04);
        border-radius: 2px;
    }

    .table-responsive::-webkit-scrollbar-thumb {
        background: var(--accent);
        border-radius: 2px;
    }

    .data-table {
        font-size: 0.78rem;
        min-width: 540px;
    }

    .data-table th, .data-table td {
        padding: 0.55rem 0.5rem;
        white-space: nowrap;
    }

    .filter-row {
        flex-direction: column;
        gap: 0.6rem;
    }

    .filter-dates {
        display: flex;
        gap: 0.5rem;
        width: 100%;
    }

    .filter-dates input {
        flex: 1;
        min-width: 0 !important;
    }

    .desktop-only { display: none !important; }
    .mobile-only { display: block !important; }
    .filter-grid { grid-template-columns: 1fr !important; }
}

@media (min-width: 769px) {
    .mobile-menu-btn { display: none !important; }
}

/* ===== Return to Shop Acc Buttons ===== */
.login-back-wrap {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-back-shop-login {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
}

.btn-back-shop-login:hover {
    color: #00f2fe;
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.6);
    transform: translateX(-3px);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.sidebar-back-shop {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(0, 242, 254, 0.05);
    border: 1px solid rgba(0, 242, 254, 0.2);
    transition: all var(--transition);
}

.sidebar-back-shop:hover {
    background: rgba(0, 242, 254, 0.15);
    color: #00f2fe;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.3);
    transform: translateX(3px);
}

.sidebar-back-shop i {
    font-size: 1.2rem;
    color: #00f2fe;
}

.mheader-right-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.btn-back-shop-header {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 242, 254, 0.08);
    border: 1px solid rgba(0, 242, 254, 0.28);
    color: #00f2fe;
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 700;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.1);
}

.btn-back-shop-header:hover {
    background: rgba(0, 242, 254, 0.2);
    color: #ffffff;
    box-shadow: 0 0 18px rgba(0, 242, 254, 0.4);
    transform: translateY(-1px);
}

.btn-back-shop-header:active {
    transform: scale(0.95);
}

.btn-back-shop-header i {
    font-size: 0.9rem;
}
