/* ==========================================================================
   ShopperSpot Platform - Custom Styles
   ========================================================================== */

/* ---------- CSS Variables (Theme) ---------- */
:root {
    --msm-sidebar-width: 250px;
    --msm-navbar-height: 56px;
    --msm-bottom-nav-height: 60px;
    --msm-accent: #0d6efd;
    --msm-accent-hover: #0b5ed7;
    --msm-radius: 0.5rem;
    --msm-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --msm-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* ---------- Sidebar (Removed - using grid menu) ---------- */
/* Desktop */
@media (min-width: 992px) {
    #main-content {
        margin-left: 0;
    }
}

/* ---------- Bottom Navigation ---------- */
.bottom-nav {
    z-index: 1030;
    background: var(--bs-body-bg) !important;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--bs-secondary);
    font-size: 0.65rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--msm-radius);
    transition: color 0.2s;
    min-width: 50px;
}

.bottom-nav-item i {
    font-size: 1.2rem;
    margin-bottom: 0.1rem;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
    color: var(--msm-accent);
}

/* Padding for bottom nav */
.pb-mobile {
    padding-bottom: calc(var(--msm-bottom-nav-height) + 1.5rem) !important;
}

/* Hide bottom nav on large desktop (optional) */
@media (min-width: 1200px) {
    .bottom-nav { display: none !important; }
    .pb-mobile { padding-bottom: 1rem !important; }
}

/* ---------- Navigation Links ---------- */
.nav-link {
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    transition: background-color 0.2s, color 0.2s;
}

.nav-link:hover:not(.active) {
    background-color: var(--bs-tertiary-bg);
}

/* ---------- Cards ---------- */
.card {
    border-radius: var(--msm-radius);
    box-shadow: var(--msm-shadow);
}

.card-stat {
    transition: transform 0.15s, box-shadow 0.15s;
}

.card-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--msm-shadow-lg);
}

/* ---------- Buttons ---------- */
.btn {
    border-radius: var(--msm-radius);
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    min-height: 48px;
}

/* Touch-friendly buttons */
.btn-touch {
    min-height: 44px;
    min-width: 44px;
}

/* ---------- Forms ---------- */
.form-control,
.form-select {
    border-radius: var(--msm-radius);
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--msm-accent);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* ---------- Tables ---------- */
.table-responsive {
    border-radius: var(--msm-radius);
}

.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--bs-secondary);
    font-weight: 600;
}

/* Mobile card-style tables */
@media (max-width: 767.98px) {
    .table-mobile-cards thead {
        display: none;
    }

    .table-mobile-cards tbody tr {
        display: block;
        margin-bottom: 0.75rem;
        border: 1px solid var(--bs-border-color);
        border-radius: var(--msm-radius);
        padding: 0.75rem;
    }

    .table-mobile-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.35rem 0;
        border: none;
    }

    .table-mobile-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.8rem;
        color: var(--bs-secondary);
    }
}

/* ---------- Badges ---------- */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
    border-radius: 1rem;
}

/* ---------- Page Header ---------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

@media (max-width: 575.98px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state i {
    font-size: 3rem;
    color: var(--bs-secondary);
    margin-bottom: 1rem;
}

/* ---------- Permission Matrix ---------- */
.permission-matrix {
    font-size: 0.8rem;
}

.permission-matrix th {
    position: sticky;
    top: 0;
    background: var(--bs-body-bg);
    z-index: 1;
}

.permission-matrix td {
    text-align: center;
    vertical-align: middle;
}

.permission-matrix .form-check-input {
    width: 1.2rem;
    height: 1.2rem;
}

/* ---------- Utilities ---------- */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.min-touch {
    min-height: 44px;
    min-width: 44px;
}

/* ---------- Animations ---------- */
@media (prefers-reduced-motion: no-preference) {
    .fade-in {
        animation: fadeIn 0.3s ease-in;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Print ---------- */
@media print {
    .sidebar,
    .bottom-nav,
    .navbar,
    .btn,
    .alert {
        display: none !important;
    }

    #main-content {
        margin-left: 0 !important;
    }
}


/* ---------- Floating Action Button ---------- */
.fab-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 1050;
}

/* ---------- Summary Cards Grid ---------- */
@media (max-width: 575.98px) {
    .card-stat .card-body {
        padding: 0.75rem;
    }

    .card-stat .fs-5 {
        font-size: 1.1rem !important;
    }
}

/* ---------- Activity Timeline ---------- */
.activity-item {
    transition: background-color 0.15s;
}

.activity-item:hover {
    background-color: var(--bs-tertiary-bg);
}

/* ---------- Dashboard Greeting ---------- */
.greeting-section h4 {
    font-weight: 600;
}

/* ---------- Quick Actions Responsive ---------- */
@media (max-width: 575.98px) {
    .quick-actions .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }
}

/* ---------- Notification Dropdown ---------- */
.notification-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
    transition: background-color 0.15s;
}

.notification-item:hover {
    background-color: var(--bs-tertiary-bg);
}

.notification-item:last-child {
    border-bottom: none;
}


/* ---------- Mobile Fixes ---------- */
@media (max-width: 767.98px) {
    /* Ensure touch targets are large enough (44×44px per UX standards) */
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; }
    .form-control, .form-select { min-height: 44px; }

    /* Navbar spacing */
    .navbar { padding: 0.4rem 0.5rem; }
    .navbar .container-fluid { padding: 0; }

    /* Cards tighter on mobile */
    .card-body { padding: 0.75rem; }

    /* Page header */
    .page-header h1 { font-size: 1.1rem; }

    /* Tables */
    .table td, .table th { padding: 0.5rem 0.4rem; font-size: 0.85rem; }

    /* Product images - consistent sizing */
    .product-grid-item .product-img,
    .product-grid-item .product-img-placeholder { height: 65px !important; }

    /* Profile photos */
    img.rounded-circle { width: 32px !important; height: 32px !important; }

    /* General images in cards */
    .card img { max-width: 100%; height: auto; }
}

@media (max-width: 991.98px) {
    /* Ensure nothing is hidden behind bottom nav */
    main.container-fluid { padding-bottom: 80px !important; }

    /* Sidebar must be above everything when shown */
    .sidebar.show { z-index: 1060; }
    .sidebar-overlay.show { z-index: 1055; }
}

/* ---------- Tablet Optimizations ---------- */
@media (min-width: 768px) and (max-width: 991.98px) {
    .page-header h1 { font-size: 1.3rem; }
    .card-stat .fs-5 { font-size: 1.15rem !important; }

    /* Product grid for tablet - slightly larger */
    .product-grid-item .product-img,
    .product-grid-item .product-img-placeholder { height: 85px !important; }
}
