/* assets/css/style.css */

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --accent-color: #ffc107;
    --dark-bg: #1a1a1a;
    --light-bg: #f8f9fa;
    --text-color: #333;
    --admin-sidebar-bg: #2c3e50;
    --admin-sidebar-width: 250px;
    --radius: 8px;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    background-color: var(--light-bg);
    color: var(--text-color);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* =====================
   HEADER & NAV
   ===================== */
header {
    background: var(--dark-bg);
    color: white;
    padding: 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 500;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.nav-logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    font-size: 0.95rem;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

/* Hamburger */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
}

/* Mobile nav drawer */
.nav-drawer {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: #111;
    z-index: 499;
    padding: 12px 20px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-direction: column;
    gap: 4px;
}

.nav-drawer.open {
    display: flex;
}

.nav-drawer a {
    color: rgba(255, 255, 255, 0.85);
    padding: 12px 10px;
    border-radius: 6px;
    font-size: 1rem;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-drawer a:last-child {
    border-bottom: none;
}

.nav-drawer a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* =====================
   HERO
   ===================== */
.hero {
    background:
        linear-gradient(135deg, rgba(0, 20, 80, 0.30), rgba(0, 10, 40, 0.42)),
        url('../../uploads/2025/06/20240802_160234.webp') center center / cover no-repeat;
    background-color: #0a2a6e;
    color: white;
    padding: 80px 0;
    text-align: center;
    margin-bottom: 0;
}

.hero h1 {
    font-size: 2.6rem;
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 30px;
}

.search-bar {
    max-width: 620px;
    margin: 0 auto;
}

.search-form {
    display: flex;
    gap: 10px;
    width: 100%;
}

.search-input {
    flex: 1;
    padding: 13px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
    min-width: 0;
}

.categories-quick-links {
    margin-top: 22px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 16px;
}

.categories-quick-links a {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 2px 0;
}

/* =====================
   HOME LAYOUT (sidebar + content)
   ===================== */
.home-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 28px;
    margin: 36px 0 60px;
    align-items: start;
}

.sidebar-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 80px;
}

.sidebar-card h3 {
    margin-top: 0;
    padding-bottom: 14px;
    border-bottom: 2px solid #f1f3f5;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--dark-bg);
}

.sidebar-card .sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-card .sidebar-menu li {
    border-bottom: 1px solid #f5f5f5;
}

.sidebar-card .sidebar-menu li:last-child {
    border-bottom: none;
}

.sidebar-card .sidebar-menu a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 4px;
    color: #444;
    transition: all 0.2s;
    font-size: 0.92rem;
}

.sidebar-card .sidebar-menu a:hover {
    color: var(--primary-color);
    background: #f8f9fa;
    padding-left: 8px;
}

.sidebar-count {
    background: #e9ecef;
    color: #6c757d;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
    margin-right: 8px;
    flex-shrink: 0;
}

/* Mobile sidebar toggle */
.sidebar-toggle-btn {
    display: none;
    width: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    margin-bottom: 0;
    align-items: center;
    gap: 8px;
    color: #333;
}

.sidebar-collapsible {
    display: block;
}

/* =====================
   BASE UI COMPONENTS
   ===================== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    transition: all 0.25s;
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #bd2130;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.85rem;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: var(--radius);
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.alert {
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
}

.alert-success {
    background: #d4edda;
    color: #155724;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
}

/* =====================
   LISTING GRID & CARDS
   ===================== */
.listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 22px;
}

.listing-card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.25s, box-shadow 0.25s;
    display: flex;
    flex-direction: column;
}

.listing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

.card-img {
    height: 170px;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.card-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.card-body {
    padding: 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.card-category {
    color: var(--secondary-color);
    font-size: 0.85rem;
    display: block;
    margin-bottom: 8px;
}

/* =====================
   SECTION TITLE
   ===================== */
.section-title {
    margin: 0 0 22px;
    font-size: 1.4rem;
    border-left: 4px solid var(--primary-color);
    padding-left: 14px;
    color: var(--dark-bg);
}

/* =====================
   FOOTER
   ===================== */
footer {
    background: var(--dark-bg);
    color: #aaa;
    padding: 36px 0;
    margin-top: 60px;
    text-align: center;
    font-size: 0.9rem;
}

/* =====================
   ADMIN PANEL
   ===================== */
.admin-sidebar {
    width: var(--admin-sidebar-width);
    background: var(--admin-sidebar-bg);
    color: #ecf0f1;
    padding: 20px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.admin-sidebar-overlay {
    display: none;
}

.admin-content {
    margin-left: var(--admin-sidebar-width);
    padding: 30px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    background-color: #f4f6f9;
}

.sidebar-header {
    margin-bottom: 30px;
    text-align: center;
}

.sidebar-link {
    display: block;
    padding: 12px 15px;
    color: #bdc3c7;
    margin-bottom: 5px;
    border-radius: 4px;
    transition: 0.2s;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding-left: 20px;
}

.sidebar-link i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.admin-mobile-header {
    display: none;
    background: var(--admin-sidebar-bg);
    color: white;
    padding: 15px;
    align-items: center;
    justify-content: space-between;
}

.mobile-toggle-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Stat cards */
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-card h3 {
    font-size: 2rem;
    margin: 0 0 5px;
}

.stat-card p {
    margin: 0;
    color: var(--secondary-color);
}

.stat-icon {
    font-size: 2.5rem;
}

/* =====================
   RESPONSIVE — Tablet (≤900px)
   ===================== */
@media (max-width: 900px) {
    .home-layout {
        grid-template-columns: 1fr;
        margin-top: 24px;
    }

    .sidebar-toggle-btn {
        display: flex;
    }

    .sidebar-collapsible {
        display: none;
    }

    .sidebar-collapsible.open {
        display: block;
    }

    .sidebar-card {
        position: static;
    }
}

/* =====================
   RESPONSIVE — Mobile (≤640px)
   ===================== */
@media (max-width: 640px) {

    /* Nav */
    .nav-links {
        display: none;
    }

    .nav-toggle {
        display: block;
    }

    nav {
        height: 56px;
    }

    .nav-drawer {
        top: 56px;
    }

    /* Hero */
    .hero {
        padding: 50px 0 40px;
    }

    .hero h1 {
        font-size: 1.7rem;
    }

    .hero p {
        font-size: 0.95rem;
    }

    .search-form {
        flex-direction: column;
    }

    .search-input {
        font-size: 1rem;
    }

    .categories-quick-links {
        gap: 6px 12px;
    }

    /* Cards — single column on phones */
    .listing-grid {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }

    .card-img {
        height: 130px;
    }

    /* Admin Panel */
    .admin-mobile-header {
        display: flex;
    }

    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.active {
        transform: translateX(0);
    }

    .admin-content {
        margin-left: 0;
        padding: 16px;
    }

    .admin-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .admin-sidebar-overlay.active {
        display: block;
    }
}

@media (max-width: 400px) {
    .listing-grid {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 1.45rem;
    }
}