/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* Light Theme (Default) */
    --primary-color: #1a1a1a;
    --accent-color: #4f46e5;
    --bg-color: #f5ebe0;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 16px;
    --navbar-bg: rgba(255, 255, 255, 0.9);
}

body {
    font-family: 'Outfit', sans-serif;
    /* Fixed diagonal stripe pattern - not affected by dark/light mode */
    background-color: #f5ebe0;
    background-image: repeating-linear-gradient(135deg,
            transparent,
            transparent 10px,
            rgba(224, 214, 200, 0.5) 10px,
            rgba(224, 214, 200, 0.5) 20px);
    color: var(--text-main);
    line-height: 1.6;
    transition: color 0.3s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.025em;
    transition: color 0.3s ease;
}

.navbar {
    background-color: var(--navbar-bg) !important;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm) !important;
    padding: 1rem 0;
    margin-bottom: 2rem;
    transition: background-color 0.3s ease;
}

/* Section Spacing - Gap between all major sections */
.container>section,
.container-fluid>section,
main>section,
main>.container,
main>.container-fluid {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* First section after navbar needs extra top spacing */
main>*:first-child,
.container>*:first-child {
    margin-top: 1rem;
}

/* Extra spacing for cards container */
.row.g-4 {
    margin-top: 1.5rem !important;
}

/* Page content wrapper - adds gap after navbar */
.page-content,
.container.py-4,
.container.py-5,
.container.mt-4,
.container.mt-5 {
    padding-top: 2rem !important;
}

/* Section spacing class */
.section-gap {
    margin-top: 3rem;
    margin-bottom: 3rem;
}

/* Hero section should have no top gap */
.hero-section,
#heroCarousel,
.carousel {
    margin-top: 0 !important;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary-color) !important;
    letter-spacing: -0.5px;
}

.nav-link {
    font-weight: 500;
    color: var(--text-main) !important;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--accent-color) !important;
}

.bg-image {
    background-size: cover;
    background-position: center;
}

.card {
    border: none;
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md);
}

.card-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.btn {
    border-radius: 10px;
    font-weight: 600;
    text-transform: none;
    padding: 0.7rem 1.4rem;
    box-shadow: none !important;
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    color: #fff;
}

.btn-primary:hover {
    filter: brightness(110%);
    transform: translateY(-1px);
}

.btn-outline-light {
    border: 2px solid #fff;
    color: #fff !important;
}

.btn-outline-light:hover {
    background-color: #fff;
    color: #000 !important;
}

.form-control,
.form-select {
    border-radius: 10px;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    background-color: var(--card-bg);
    color: var(--text-main);
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
    border-color: var(--accent-color);
    background-color: var(--card-bg);
    color: var(--text-main);
}

.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.table {
    color: var(--text-main);
    border-color: var(--border-color);
}

.badge {
    padding: 0.5em 0.8em;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 6px;
}

/* Auth Pages Polish */
.auth-card {
    max-width: 450px;
    margin: 5rem auto;
    padding: 2.5rem;
    border-radius: 20px;
    background: var(--card-bg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

/* Text Colors overrides */
.text-muted {
    color: var(--text-muted) !important;
}

/* ===== MOBILE-FIRST RESPONSIVE STYLES ===== */

/* Mobile Base Styles */
@media (max-width: 768px) {

    /* Body spacing for mobile nav */
    body {
        padding-top: 56px !important;
        padding-bottom: 80px !important;
    }

    /* Container adjustments */
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Touch-friendly buttons */
    .btn {
        min-height: 48px;
        padding: 12px 24px;
        font-size: 1rem;
        touch-action: manipulation;
    }

    .btn-mobile-block {
        width: 100%;
        display: block;
    }

    /* Touch-friendly form inputs */
    input,
    select,
    textarea,
    .form-control,
    .form-select {
        min-height: 48px;
        font-size: 16px !important;
        /* Prevents iOS zoom */
        padding: 12px 16px;
    }

    /* Headings */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.1rem;
    }

    /* Hide desktop navbar on mobile - only for frontend, not admin */
    .navbar:not(.mobile-appbar):not(.navbar-admin) {
        display: none !important;
    }

    /* Product cards - list style on mobile */
    .product-grid {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .product-card {
        display: flex;
        flex-direction: row;
        border-radius: 12px;
        overflow: hidden;
    }

    .product-card .card-img {
        width: 120px;
        height: 120px;
        flex-shrink: 0;
    }

    .product-card .card-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .product-card .card-body {
        padding: 12px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        text-align: left;
    }

    /* Auth cards */
    .auth-card {
        margin: 1rem;
        padding: 1.5rem;
        border-radius: 16px;
    }

    /* Tables responsive */
    .table-responsive {
        border-radius: 12px;
        overflow: hidden;
    }

    /* Cards full width */
    .card {
        border-radius: 12px;
    }

    /* Footer spacing for bottom nav */
    .desktop-footer {
        margin-bottom: 80px;
    }
}

/* Tablet styles */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding-left: 24px;
        padding-right: 24px;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop styles */
@media (min-width: 1025px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .product-grid.grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== FRONTEND SIDEBAR STYLES (scoped to .page-with-sidebar) ===== */
.page-with-sidebar {
    display: flex;
    min-height: calc(100vh - 80px);
}

.page-with-sidebar .sidebar {
    width: 280px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 24px 0;
    position: sticky;
    top: 80px;
    height: calc(100vh - 80px);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-main);
}

.sidebar-nav {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    width: 100%;
}

.sidebar-nav a:hover {
    background: rgba(160, 82, 45, 0.08);
    color: #a0522d;
}

.sidebar-nav a.active {
    background: rgba(160, 82, 45, 0.12);
    color: #a0522d;
    border-left-color: #a0522d;
}

.sidebar-nav a i {
    width: 20px;
    font-size: 1rem;
    color: inherit;
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 12px 0;
}

.page-with-sidebar .main-content {
    flex: 1;
    padding: 24px;
    background: var(--bg-color);
}

/* Hide frontend sidebar on mobile */
@media (max-width: 768px) {
    .page-with-sidebar {
        flex-direction: column;
        display: block !important;
    }

    .page-with-sidebar .sidebar {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
    }

    .page-with-sidebar .main-content {
        padding: 16px;
        width: 100% !important;
    }
}

/* ===== ENHANCED ANIMATIONS ===== */
.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

.slide-up {
    animation: slideUp 0.3s ease forwards;
}

.scale-in {
    animation: scaleIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Smooth transitions */
* {
    -webkit-tap-highlight-color: transparent;
}

a,
button,
.btn {
    transition: all 0.2s ease;
}