/* assets/css/style.css — ElectroStore theme (loaded after Bootstrap 5) */

:root {
    --primary: #0d6efd;
    --secondary: #6c757d;
    --success: #198754;
    --danger: #dc3545;
    --warning: #ffc107;
    --dark: #212529;
    --light: #f8f9fa;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f6fa;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main { flex: 1 0 auto; }
a { text-decoration: none; }
.text-right { text-align: right; }
.muted { color: var(--secondary) !important; }
.small { font-size: .8rem; }

/* Top Bar ------------------------------------------------------------------ */
.top-bar {
    font-size: 0.8rem;
    background: var(--dark);
    color: rgba(255, 255, 255, .75);
    padding: .4rem 0;
}
.top-bar a { color: #fff; }

/* Navbar ------------------------------------------------------------------- */
.navbar-brand {
    font-size: 1.4rem;
    font-weight: 700;
}
.navbar-search { max-width: 380px; }
.navbar-search .form-control { border-radius: 20px 0 0 20px; }
.navbar-search .btn { border-radius: 0 20px 20px 0; }
.cart-badge { font-size: 0.6rem; vertical-align: super; }
.dropdown-toggle::after { margin-left: .35em; }

/* Hero Section ------------------------------------------------------------- */
.hero-section {
    background: linear-gradient(135deg, #0d6efd 0%, #0056b3 100%);
    padding: 60px 0;
    color: white;
    border-radius: 0 0 20px 20px;
    margin-bottom: 30px;
}
.hero-section h1 { font-size: 2.5rem; font-weight: 700; }
.hero-section p { opacity: .9; max-width: 55ch; }
.hero-section.hero-bg-image { background-color: rgba(0,0,0,.55); background-blend-mode: multiply; }
.hero-section.hero-bg-image h1, .hero-section.hero-bg-image p { text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.hero-section .btn-outline-light { border-color: rgba(255,255,255,.85); }
.hero-section .form-control {
    border-radius: 25px;
    padding: .7rem 1.2rem;
    border: 0;
    min-width: min(320px, 70vw);
}

/* Section headings --------------------------------------------------------- */
.section-title { font-weight: 700; margin-bottom: 1rem; }
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

/* Category Cards ----------------------------------------------------------- */
.category-card {
    transition: transform 0.3s, box-shadow 0.3s;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    color: #333;
    height: 100%;
}
.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}
.category-card .card-body { padding: 20px; }
.category-icon { font-size: 2.5rem; color: var(--primary); margin-bottom: 10px; }

/* Product Cards ------------------------------------------------------------ */
.product-card {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    background: white;
}
.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}
.product-card .product-image {
    position: relative;
    overflow: hidden;
    height: 200px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}
.product-card .product-image img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    padding: 15px;
    transition: transform 0.3s;
}
.product-card:hover .product-image img { transform: scale(1.05); }
.product-badge { position: absolute; top: 10px; left: 10px; z-index: 2; }
.product-card .card-body { padding: 15px; display: flex; flex-direction: column; gap: .3rem; }
.product-card .product-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-decoration: none;
}
.product-card .product-title:hover { color: var(--primary); }
.product-card .product-sku { font-size: 0.75rem; color: #999; }
.product-card .product-price { font-size: 1.15rem; font-weight: 700; color: var(--primary); }
.product-card .original-price { text-decoration: line-through; color: #999; font-size: 0.85rem; font-weight: 400; }
.product-card .sale-badge { background: var(--danger); color: white; font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; }
.product-card .btn { margin-top: auto; }

.stock-status { font-size: 0.8rem; }
.stock-in { color: var(--success); }
.stock-low { color: #b8860b; }
.stock-out { color: var(--danger); }

/* Product Detail Page ------------------------------------------------------ */
.product-detail-image {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
}
.product-detail-image img { max-width: 100%; max-height: 400px; object-fit: contain; }
.product-detail .price-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}
.product-detail .price-section .product-price { font-size: 2rem; font-weight: 700; color: var(--primary); }
.product-detail .spec-table th { width: 35%; background: #f8f9fa; }

/* Cart --------------------------------------------------------------------- */
.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 5px;
}
.qty-input { width: 80px; text-align: center; }
.cart-summary {
    position: sticky;
    top: 90px;
}

/* Checkout ----------------------------------------------------------------- */
.checkout-summary ul { list-style: none; margin: 0; padding: 0; }
.checkout-summary li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .4rem 0;
    border-bottom: 1px solid #eee;
}
.checkout-summary .grand-total { font-size: 1.15rem; font-weight: 700; }

/* Order Status Badges ------------------------------------------------------ */
.badge-pending { background-color: #ffc107; color: #333; }
.badge-confirmed { background-color: #17a2b8; }
.badge-processing { background-color: #0d6efd; }
.badge-shipped { background-color: #6f42c1; }
.badge-delivered { background-color: #198754; }
.badge-cancelled { background-color: #dc3545; }
.badge-refunded { background-color: #6c757d; }
.badge-new { background-color: #0d6efd; }
.badge-contacted { background-color: #fd7e14; }
.badge-fulfilled { background-color: #198754; }
.badge-dismissed { background-color: #6c757d; }
.badge-answered { background-color: #198754; }
.badge { font-size: .7rem; }

/* Sidebar Filters ---------------------------------------------------------- */
.filter-sidebar .card { border: none; border-radius: 12px; }
.filter-sidebar .card-header {
    background: white;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    border-radius: 12px 12px 0 0 !important;
}
.filter-sidebar .list-group-item { border-color: #f0f0f0; }
.filter-sidebar .list-group-item.active { background: var(--primary); border-color: var(--primary); }

/* Tables ------------------------------------------------------------------- */
.table { background: #fff; vertical-align: middle; }
.table thead th {
    background: #fff;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--secondary);
    border-bottom-width: 1px;
    white-space: nowrap;
}
.table > :not(caption) > * > * { padding: .7rem .75rem; }
.table img { border-radius: 8px; object-fit: contain; background: #f8f9fa; }
.table .actions { display: flex; gap: .35rem; flex-wrap: wrap; }

/* Admin Panel -------------------------------------------------------------- */
.admin-wrapper { display: flex; align-items: stretch; min-height: calc(100vh - 56px); }
.admin-sidebar {
    min-height: calc(100vh - 56px);
    background: #2c3e50;
    width: 250px;
    flex: 0 0 250px;
}
.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 12px 20px;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
}
.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    text-decoration: none;
}
.admin-sidebar .nav-link i { width: 25px; font-size: 1rem; }
.admin-sidebar .sidebar-title {
    color: rgba(255, 255, 255, .5);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    padding: 18px 20px 6px;
}
.admin-content { flex: 1; min-width: 0; padding: 1.5rem; }

.stat-card { border: none; border-radius: 12px; transition: transform 0.2s; }
.stat-card:hover { transform: translateY(-3px); }
.stat-card .stat-icon { font-size: 2.5rem; opacity: 0.3; line-height: 1; }
.stat-card .stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--secondary); }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; }

/* Gradient stat cards (dashboard) */
.stat-card-1 { background: linear-gradient(135deg, #1a73e8, #0d47a1); color: #fff; }
.stat-card-2 { background: linear-gradient(135deg, #43a047, #1b5e20); color: #fff; }
.stat-card-3 { background: linear-gradient(135deg, #fb8c00, #e65100); color: #fff; }
.stat-card-4 { background: linear-gradient(135deg, #e91e63, #880e4f); color: #fff; }
.stat-card-grad { border-radius: 12px; padding: 24px; color: #fff; position: relative; overflow: hidden; }
.stat-card-grad .stat-icon { font-size: 3rem; opacity: 0.3; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); }

.admin-form-card { border: none; border-radius: 12px; max-width: 720px; }
.current-image { background: #f8f9fa; border-radius: 10px; padding: 15px; }

/* Breadcrumb --------------------------------------------------------------- */
.breadcrumb { background: none; padding: 0; margin-bottom: 20px; }
.breadcrumb-item a { text-decoration: none; color: var(--primary); }
.breadcrumb-item.active { color: var(--secondary); }

/* Rating Stars ------------------------------------------------------------- */
.stars { display: inline-block; }
.stars i { font-size: 0.9rem; }

/* Quantity buttons --------------------------------------------------------- */
.qty-group .btn { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; }
.qty-group .form-control { width: 70px; text-align: center; height: 38px; }

/* Alerts ------------------------------------------------------------------- */
.alert { border-radius: 10px; border: none; }
.alert ul { margin: 0; padding-left: 1.1rem; }

/* Empty states ------------------------------------------------------------- */
.empty-state {
    background: #fff;
    border: 1px dashed #dee2e6;
    border-radius: 12px;
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--secondary);
}
.empty-state i { font-size: 2.2rem; opacity: .4; display: block; margin-bottom: .5rem; }

/* Footer ------------------------------------------------------------------- */
.site-footer {
    background: #fff;
    border-top: 1px solid #e9ecef;
    padding: 2rem 0 1.5rem;
    font-size: .9rem;
}
.site-footer h6 { font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: .8rem; }
.site-footer a { color: var(--secondary); }
.site-footer a:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid #eee; margin-top: 1.25rem; padding-top: 1rem; }

/* Skeleton loading effect -------------------------------------------------- */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Announcement bar --------------------------------------------------------- */
.announcement-bar {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    line-height: 1.3;
}
.announcement-bar .announcement-track {
    display: inline-flex;
    align-items: center;
    will-change: transform;
}
.announcement-bar .announcement-track.is-scrolling {
    animation-name: announcement-scroll;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
.announcement-bar .announcement-item {
    display: inline-flex;
    align-items: center;
}
.announcement-bar .announcement-item i {
    margin-right: .4rem;
}
@keyframes announcement-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
    .announcement-bar .announcement-track.is-scrolling { animation: none; }
}

/* Auth / account pages ----------------------------------------------------- */
.auth-card { border: none; border-radius: 14px; max-width: 440px; }
.auth-card .btn-block { margin-top: 1.1rem; }
.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
}

/* Installer ---------------------------------------------------------------- */
.install-log { font-size: .9rem; }
.install-log .done { color: var(--success); }
.install-log .error { color: var(--danger); }

/* Responsive --------------------------------------------------------------- */
@media (max-width: 991px) {
    .admin-wrapper { flex-direction: column; }
    .admin-sidebar { width: 100%; flex: none; min-height: 0; }
    .admin-sidebar .nav-link { border-left: none; border-bottom: 3px solid transparent; }
    .admin-sidebar .nav-link:hover,
    .admin-sidebar .nav-link.active { border-left-color: transparent; border-bottom-color: var(--primary); }
    .admin-sidebar .nav { flex-direction: row; flex-wrap: wrap; padding: .5rem; }
    .admin-sidebar .sidebar-title { display: none; }
    .admin-content { padding: 1rem; }
    .cart-summary { position: static; }
}

@media (max-width: 768px) {
    .hero-section h1 { font-size: 1.8rem; }
    .hero-section { padding: 40px 0; }
    .product-card .product-image { height: 160px; }
    .navbar-search { max-width: none; }
}

/* Flash deals + promotion banners ------------------------------------------------- */
.flash-deal-card { position: relative; }
.flash-deal-card > a { display: block; color: inherit; outline: 0; }
.flash-deal-badge { position: absolute; top: 8px; left: 8px; z-index: 2; border-radius: 6px; font-weight: 600; }
.banner-card { transition: box-shadow .2s ease, transform .2s ease; }
.banner-card:hover { box-shadow: 0 .5rem 1rem rgba(0,0,0,.15) !important; transform: translateY(-2px); }

/* Home hero slider ---------------------------------------------------------- */
.home-hero-slider {
    position: relative;
    /* Rendered outside .container (see index.php) so it spans the full viewport
       width; no 100vw trick needed, so no horizontal-scrollbar overflow. */
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.home-hero-slider .carousel-item {
    background: #0d1b2a;
    overflow: hidden;
}
.home-hero-slider .carousel-indicators { margin-bottom: .75rem; }
.home-hero-slider .carousel-indicators [data-bs-target] {
    width: 28px; height: 4px; border-radius: 4px;
    background-color: #fff; opacity: .45; border: 0;
}
.home-hero-slider .carousel-indicators .active { opacity: 1; }
.home-hero-slider .carousel-control-prev,
.home-hero-slider .carousel-control-next { width: 8%; opacity: .75; }
.home-hero-slider .carousel-control-prev:hover,
.home-hero-slider .carousel-control-next:hover { opacity: 1; }
.home-hero-slider .carousel-fade .carousel-item { opacity: 0; transition-property: opacity; transform: none; }

/* When the group carousel overlaps the hero, the pagination moves to the top
   corner so the overlapping cards cannot cover it. */
.home-hero-slider--overlap .carousel-indicators {
    top: .75rem;
    bottom: auto;
    margin: 0 .75rem 0 0;
    justify-content: flex-end;
}

/* Home category group carousel --------------------------------------------- */
.home-group-carousel { position: relative; }
/* Net overlap = hero 1.5rem bottom margin + this negative top margin. */
.home-group-carousel--overlap {
    margin-top: -6rem;
    z-index: 3;
}
.home-group-carousel--overlap .home-group-card {
    box-shadow: 0 .75rem 1.75rem rgba(0,0,0,.16);
}
.home-group-viewport { overflow: hidden; }
.home-group-track {
    display: flex;
    gap: 1rem;
    transition: transform .45s cubic-bezier(.4,.14,.3,1);
    will-change: transform;
}
.home-group-card {
    flex: 0 0 calc(50% - .5rem);
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 12px;
    padding: 1rem 1.1rem 1.15rem;
    box-shadow: 0 .25rem .75rem rgba(0,0,0,.06);
    min-width: 0;
}
.home-group-card h5 { font-size: 1rem; }
.home-group-see-more { color: var(--primary, #0d6efd); font-weight: 600; text-decoration: none; white-space: nowrap; }
.home-group-see-more:hover { text-decoration: underline; }
.home-group-items { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
.home-group-tile { display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center; min-width: 0; }
.home-group-tile-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    background: #f5f6f8;
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s ease, box-shadow .2s ease;
}
.home-group-tile-img img { width: 100%; height: 100%; object-fit: cover; }
.home-group-tile:hover .home-group-tile-img { transform: translateY(-3px); box-shadow: 0 .4rem .8rem rgba(0,0,0,.14); }
.home-group-tile-name {
    font-size: .78rem; line-height: 1.25; color: var(--bs-body-color, #212529);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; word-break: break-word;
}
.home-group-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 38px; height: 38px; border-radius: 50%;
    border: 0; background: #fff; color: var(--primary, #0d6efd);
    box-shadow: 0 .25rem .6rem rgba(0,0,0,.18);
    display: flex; align-items: center; justify-content: center;
    z-index: 5; transition: background .2s ease, opacity .2s ease;
}
.home-group-nav:hover { background: var(--primary, #0d6efd); color: #fff; }
.home-group-nav:disabled { opacity: 0; pointer-events: none; }
.home-group-prev { left: -6px; }
.home-group-next { right: -6px; }
.home-group-carousel:hover .home-group-nav { opacity: 1; }

@media (min-width: 992px) {
    .home-group-card { flex: 0 0 calc(33.3333% - .667rem); }
}
@media (max-width: 575.98px) {
    .home-group-card { flex: 0 0 100%; }
    .home-group-nav { width: 32px; height: 32px; }
    .home-group-prev { left: 0; }
    .home-group-next { right: 0; }
    .home-group-carousel--overlap { margin-top: -4rem; }
}
@media (prefers-reduced-motion: reduce) {
    .home-group-track { transition: none; }
}
