/**
 * Harvest Application - Space-Saving & Mobile-Ready CSS
 * Powered by Mobile Bootstrap 5
 */

:root {
    --topnav-height: 40px;
    --harvest-primary: #10b981;
    --harvest-primary-dark: #059669;
    --harvest-indigo: #4f46e5;
    --shopee-orange: #ee4d2d;
    --shopee-orange-hover: #d73211;
    --shopee-gradient: linear-gradient(135deg, #ff5722 0%, #ee4d2d 100%);
    --harvest-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --dark-surface: #0f172a;
    --light-bg: #f8fafc;
    --card-border: #e2e8f0;
    --text-muted: #64748b;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--light-bg);
    color: #1e293b;
    font-size: 0.875rem; /* Space-saving default base font */
    line-height: 1.45;
    padding-bottom: 60px; /* Space for mobile bottom bar */
}

@media (min-width: 768px) {
    body {
        padding-bottom: 0;
    }
}

/* Compact Typography */
h1, .h1 { font-size: 1.5rem; font-weight: 700; }
h2, .h2 { font-size: 1.25rem; font-weight: 600; }
h3, .h3 { font-size: 1.1rem; font-weight: 600; }
h4, .h4 { font-size: 0.95rem; font-weight: 600; }
h5, .h5 { font-size: 0.85rem; font-weight: 600; }

/* Top Navbar */
.harvest-navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--card-border);
    height: var(--topnav-height, 40px);
    min-height: var(--topnav-height, 40px);
    max-height: var(--topnav-height, 40px);
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    z-index: 1050 !important;
}

.harvest-navbar > .container-fluid {
    height: 100%;
    min-height: var(--topnav-height, 40px);
    padding-top: 0;
    padding-bottom: 0;
}

/* Sidenav Toggle Button in Topbar */
.sidenav-toggle-btn {
    border: none;
    background: transparent;
    color: #475569;
    padding: 0.15rem 0.35rem;
    border-radius: 5px;
    font-size: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
    width: 28px;
    height: 28px;
}

.sidenav-toggle-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.sidenav-toggle-btn:active {
    transform: scale(0.95);
}

/* Webhook Notifications Compact Topbar Dropdown */
#webhookNotifDropdownMenu {
    width: 480px;
    max-width: calc(100vw - 20px);
    font-size: 0.82rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15) !important;
}

#webhookNotifDropdownMenu .list-group {
    max-height: 480px;
    overflow-y: auto;
    overflow-x: hidden;
}

@media (max-width: 575.98px) {
    #webhookNotifDropdownMenu {
        position: fixed !important;
        top: 46px !important;
        left: 10px !important;
        right: 10px !important;
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        transform: none !important;
    }
}

/* Sidenav Mobile Backdrop (Active only when mobile drawer is open) */
.sidenav-backdrop {
    display: none;
}

@media (max-width: 991.98px) {
    .sidenav-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(15, 23, 42, 0.45);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
        pointer-events: none;
    }
    body.sidenav-open .sidenav-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    body.sidenav-open {
        overflow: hidden !important;
    }
}

/* Harvest Sidenav (Dedicated Operational Navigation) */
.harvest-sidenav {
    background: #ffffff !important;
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
}

.sidenav-mobile-header {
    display: none;
}

@media (min-width: 992px) {
    .harvest-sidenav {
        position: fixed !important;
        top: var(--topnav-height, 40px) !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 240px !important;
        height: calc(100vh - var(--topnav-height, 40px)) !important;
        visibility: visible !important;
        transform: none !important;
        z-index: 1030 !important;
        box-shadow: 1px 0 6px rgba(0, 0, 0, 0.03);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .sidenav-mobile-header {
        display: none !important;
    }
    .harvest-main-wrapper {
        margin-left: 240px !important;
        min-height: calc(100vh - var(--topnav-height, 40px));
        display: flex;
        flex-direction: column;
        transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }
    body.sidenav-collapsed .harvest-sidenav {
        transform: translateX(-100%) !important;
    }
    body.sidenav-collapsed .harvest-main-wrapper {
        margin-left: 0 !important;
    }
}

@media (max-width: 991.98px) {
    .harvest-sidenav {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 280px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        z-index: 1050 !important; /* Higher than backdrop (1040) */
        transform: translateX(-100%) !important;
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.2) !important;
    }
    .sidenav-mobile-header {
        display: flex !important;
    }
    body.sidenav-open .harvest-sidenav {
        transform: translateX(0) !important;
    }
    .harvest-main-wrapper {
        margin-left: 0 !important;
        min-height: calc(100vh - var(--topnav-height, 40px));
        display: flex;
        flex-direction: column;
    }
}

/* Sidenav Navigation Elements */
.sidenav-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
    padding: 0.65rem 0.95rem 0.25rem;
}

.sidenav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.85rem;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: 6px;
    margin: 1px 0.5rem;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
}

.sidenav-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    color: #64748b;
    transition: color 0.15s ease-in-out;
}

.sidenav-link:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.sidenav-link:hover i {
    color: #0f172a;
}

.sidenav-link.active {
    background-color: #ecfdf5;
    color: #059669;
    font-weight: 600;
}

.sidenav-link.active i {
    color: #059669;
}

.sidenav-link.active-shopee {
    background-color: #fff1f0;
    color: #ee4d2d;
    font-weight: 600;
}

.sidenav-link.active-shopee i {
    color: #ee4d2d;
}

/* Sidenav Scrollable Menu Area */
.sidenav-menu-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidenav-menu-scroll::-webkit-scrollbar {
    width: 4px;
}
.sidenav-menu-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.sidenav-menu-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.sidenav-menu-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.harvest-brand {
    font-weight: 800;
    font-size: 1.02rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    color: #0f172a;
    letter-spacing: -0.02em;
    line-height: 1;
}

.harvest-brand .brand-icon {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    background: var(--harvest-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
}

/* Role Badges */
.badge-role {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-role-superadmin {
    background-color: #ede9fe;
    color: #6366f1;
    border: 1px solid #c7d2fe;
}

.badge-role-admin {
    background-color: #e0f2fe;
    color: #0284c7;
    border: 1px solid #bae6fd;
}

.badge-role-editor {
    background-color: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.badge-role-user {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* Shopee Brand Styling */
.badge-shopee {
    background-color: #ffedd5;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.btn-shopee {
    background: var(--shopee-gradient);
    color: #ffffff;
    border: none;
    font-weight: 600;
}

.btn-shopee:hover, .btn-shopee:focus {
    background: linear-gradient(135deg, #e64a19 0%, #d84315 100%);
    color: #ffffff;
}

.btn-harvest {
    background: var(--harvest-gradient);
    color: #ffffff;
    border: none;
    font-weight: 600;
}

.btn-harvest:hover, .btn-harvest:focus {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
    color: #ffffff;
}

/* Space-Saving Cards */
.card-compact {
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    margin-bottom: 0.75rem;
}

.card-compact .card-header {
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--card-border);
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-compact .card-body {
    padding: 0.75rem;
}

.card-compact .card-footer {
    padding: 0.4rem 0.75rem;
    background: #f8fafc;
    border-top: 1px solid var(--card-border);
    font-size: 0.75rem;
}

/* Dense Tables (Space Saving) */
.table-dense {
    font-size: 0.8rem;
    margin-bottom: 0;
}

.table-dense th {
    padding: 0.45rem 0.55rem;
    font-weight: 600;
    background-color: #f8fafc;
    color: #475569;
    border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
}

.table-dense td {
    padding: 0.4rem 0.55rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.table-dense tr:hover td {
    background-color: #f8fafc;
}

/* Stat Box Compact */
.stat-box {
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-box .stat-val {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.1;
    color: #0f172a;
}

.stat-box .stat-lbl {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-box .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

/* Mobile Bottom Navigation Bar (App Experience) */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 54px;
    background: #ffffff;
    border-top: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1040;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 500;
    flex: 1;
    height: 100%;
    padding: 2px 0;
    transition: all 0.15s ease;
}

.mobile-nav-item i {
    font-size: 1.15rem;
    margin-bottom: 1px;
}

.mobile-nav-item.active, .mobile-nav-item:hover {
    color: var(--harvest-primary-dark);
}

.mobile-nav-item.shopee-nav.active {
    color: var(--shopee-orange);
}

/* Flash Messages */
.flash-message {
    border-radius: 6px;
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* JSON Response Viewer (API Tester) */
.json-viewer {
    background: #0f172a;
    color: #38bdf8;
    padding: 0.75rem;
    border-radius: 6px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.78rem;
    max-height: 420px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Website Landing Page Styles */
.hero-section {
    background: radial-gradient(circle at top right, #ecfdf5 0%, #f0fdf4 35%, #ffffff 100%);
    border-bottom: 1px solid var(--card-border);
    padding: 2.5rem 0;
}

.hero-badge {
    background: #dcfce7;
    color: #166534;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.feature-card {
    padding: 1rem;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: #ffffff;
    height: 100%;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.feature-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.65rem;
}

/* Flash Alerts & Auto-Dismiss Animation */
.auto-dismiss-alert {
    position: relative;
    overflow: hidden;
    transition: opacity 0.4s ease, max-height 0.4s ease, margin 0.4s ease, padding 0.4s ease;
    border-radius: 8px;
}

.auto-dismiss-alert.collapsing-alert {
    opacity: 0 !important;
    max-height: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0 !important;
}

.alert-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    animation: alertCountDown 10s linear forwards;
    pointer-events: none;
}

@keyframes alertCountDown {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Live On-Screen Webhook Push Toast Notifications */
#liveWebhookToastContainer {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 100000;
    max-width: 380px;
    width: 100%;
    pointer-events: none;
}

.live-webhook-toast {
    pointer-events: auto;
    position: relative;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.18), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #dc3545 !important;
    border-top: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0.75rem;
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.live-webhook-toast.test-push-toast {
    border-left-color: #f59e0b !important;
}

.live-webhook-toast.collapsing-toast {
    opacity: 0 !important;
    transform: translateX(80px) scale(0.95);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes beaconPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
    100% { transform: scale(1); opacity: 1; }
}

.pulse-beacon {
    display: inline-block;
    animation: beaconPulse 1.4s infinite ease-in-out;
}

@keyframes bellShake {
    0%, 100% { transform: rotate(0deg); }
    20%, 60% { transform: rotate(15deg); }
    40%, 80% { transform: rotate(-15deg); }
}

.bell-shake {
    display: inline-block;
    animation: bellShake 0.6s ease-in-out;
}

