/* ============================================================
   TICSA Shop — style.css
   Paleta: navy #0a1628 | blue #1a4a7a | accent #1e8bc3 | white #ffffff
   ============================================================ */

/* ── Variables ── */
:root {
    --navy:       #0a1628;
    --blue:       #1a4a7a;
    --accent:     #1e8bc3;
    --accent-dark:#1570a0;
    --white:      #ffffff;
    --gray-50:    #f8fafc;
    --gray-100:   #f1f5f9;
    --gray-200:   #e2e8f0;
    --gray-400:   #94a3b8;
    --gray-600:   #475569;
    --gray-800:   #1e293b;
    --success:    #16a34a;
    --danger:     #dc2626;
    --warning:    #d97706;

    --font-sans:  'Segoe UI', system-ui, -apple-system, sans-serif;
    --radius:     6px;
    --radius-lg:  10px;
    --shadow:     0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
    --shadow-md:  0 4px 6px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.08);
    --shadow-lg:  0 10px 15px rgba(0,0,0,.10), 0 4px 6px rgba(0,0,0,.06);
    --transition: .18s ease;
}

/* ── Reset base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-sans); font-size: 15px; color: var(--gray-800); background: var(--gray-50); line-height: 1.6; }
img  { max-width: 100%; height: auto; display: block; }
a    { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
ul   { list-style: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }

/* ── Utilidades ── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.sr-only   { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.gap-1 { gap: 8px; }

/* ── Botones ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border-radius: var(--radius); font-size: .9rem;
    font-weight: 600; letter-spacing: .02em; transition: background var(--transition), opacity var(--transition);
    border: 2px solid transparent;
}
.btn--primary   { background: var(--accent); color: var(--white); }
.btn--primary:hover { background: var(--accent-dark); color: var(--white); }
.btn--secondary { background: var(--blue); color: var(--white); }
.btn--secondary:hover { background: var(--navy); color: var(--white); }
.btn--outline   { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn--outline:hover { background: var(--accent); color: var(--white); }
.btn--danger    { background: var(--danger); color: var(--white); }
.btn--sm        { padding: 6px 14px; font-size: .82rem; }
.btn--block     { width: 100%; }
.btn:disabled   { opacity: .5; cursor: not-allowed; }

/* ── Topbar ── */
.topbar { background: var(--navy); color: rgba(255,255,255,.75); font-size: .78rem; padding: 6px 0; }
.topbar__inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; }
.topbar a { color: rgba(255,255,255,.85); }
.topbar a:hover { color: var(--white); }

/* ── Header ── */
.site-header { background: var(--white); border-bottom: 3px solid var(--accent); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 200; }
.header__inner { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; padding: 12px 16px; }
.header__logo img { height: 52px; width: auto; object-fit: contain; }

.header__search { display: flex; align-items: center; background: var(--gray-100); border: 1.5px solid var(--gray-200); border-radius: 50px; overflow: hidden; transition: border-color var(--transition); }
.header__search:focus-within { border-color: var(--accent); background: var(--white); }
.header__search input { flex: 1; border: none; background: transparent; padding: 9px 16px; font-size: .9rem; outline: none; }
.header__search button { padding: 9px 14px; color: var(--gray-600); background: transparent; transition: color var(--transition); }
.header__search button:hover { color: var(--accent); }

.header__actions { display: flex; align-items: center; gap: 10px; }

/* ── Cart button ── */
.btn-cart { position: relative; padding: 8px; color: var(--navy); border-radius: var(--radius); transition: color var(--transition), background var(--transition); }
.btn-cart:hover { color: var(--accent); background: var(--gray-100); }
.cart-badge { position: absolute; top: 2px; right: 2px; background: var(--accent); color: var(--white); font-size: .65rem; font-weight: 700; min-width: 17px; height: 17px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

/* ── Hamburger ── */
.btn-hamburger { display: none; flex-direction: column; gap: 5px; padding: 8px 6px; border-radius: var(--radius); }
.btn-hamburger span { display: block; width: 22px; height: 2px; background: var(--navy); border-radius: 2px; transition: transform .2s, opacity .2s; }
.btn-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.btn-hamburger.open span:nth-child(2) { opacity: 0; }
.btn-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Nav ── */
.site-nav { background: var(--blue); }
.nav__inner { }
.nav__list  { display: flex; align-items: stretch; }
.nav__list > li > a { display: block; padding: 12px 18px; color: rgba(255,255,255,.9); font-size: .88rem; font-weight: 500; letter-spacing: .02em; transition: background var(--transition), color var(--transition); }
.nav__list > li > a:hover,
.nav__list > li > a.active { background: var(--accent); color: var(--white); }
.nav__list > li > a.active { font-weight: 700; }

/* Dropdown */
.nav__dropdown { position: relative; }
.nav__dropdown-toggle { display: flex !important; align-items: center; gap: 4px; }
.nav__submenu { display: none; position: absolute; top: 100%; left: 0; min-width: 220px; background: var(--white); border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-lg); z-index: 300; border-top: 3px solid var(--accent); }
.nav__dropdown:hover .nav__submenu { display: block; }
.nav__submenu li a { display: block; padding: 10px 16px; color: var(--gray-800); font-size: .87rem; border-bottom: 1px solid var(--gray-100); transition: background var(--transition), color var(--transition); }
.nav__submenu li a:hover { background: var(--gray-50); color: var(--accent); }
.nav__submenu-all a { color: var(--accent) !important; font-weight: 600; }

/* ── Carrito Drawer ── */
.cart-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 400; opacity: 0; pointer-events: none; transition: opacity .2s; }
.cart-overlay.open { opacity: 1; pointer-events: all; }
.cart-drawer { position: fixed; top: 0; right: -380px; width: 360px; max-width: 95vw; height: 100vh; background: var(--white); z-index: 500; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transition: right .25s ease; }
.cart-drawer.open { right: 0; }
.cart-drawer__header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; background: var(--navy); color: var(--white); }
.cart-drawer__header h2 { font-size: 1rem; font-weight: 600; }
.cart-drawer__close { color: var(--white); font-size: 1.2rem; padding: 4px 8px; border-radius: var(--radius); }
.cart-drawer__close:hover { background: rgba(255,255,255,.15); }
.cart-drawer__items { flex: 1; overflow-y: auto; padding: 16px; }
.cart-empty { color: var(--gray-600); text-align: center; margin-top: 40px; }
.cart-drawer__footer { padding: 16px; border-top: 1px solid var(--gray-200); }
.cart-subtotal { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: .95rem; }
.cart-subtotal strong { color: var(--accent); font-size: 1.1rem; }

/* Item carrito */
.cart-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.cart-item__img { width: 64px; height: 64px; object-fit: contain; border-radius: var(--radius); background: var(--gray-100); }
.cart-item__name { font-size: .85rem; font-weight: 500; line-height: 1.3; margin-bottom: 4px; }
.cart-item__price { font-size: .9rem; color: var(--accent); font-weight: 700; }
.cart-item__qty { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.cart-item__qty button { width: 24px; height: 24px; border-radius: 50%; background: var(--gray-100); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: .9rem; transition: background var(--transition); }
.cart-item__qty button:hover { background: var(--accent); color: var(--white); }
.cart-item__qty span { min-width: 20px; text-align: center; font-weight: 600; }
.cart-item__remove { color: var(--gray-400); font-size: 1rem; align-self: start; padding: 2px 4px; }
.cart-item__remove:hover { color: var(--danger); }

/* ── Productos grid ── */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }

.product-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow var(--transition), transform var(--transition); }
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.product-card__img { aspect-ratio: 1; overflow: hidden; background: var(--gray-100); }
.product-card__img img { width: 100%; height: 100%; object-fit: contain; padding: 12px; transition: transform .3s; }
.product-card:hover .product-card__img img { transform: scale(1.04); }
.product-card__body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.product-card__brand { font-size: .72rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.product-card__name  { font-size: .88rem; font-weight: 500; color: var(--gray-800); line-height: 1.35; flex: 1; }
.product-card__price { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.product-card__price-desc { font-size: .82rem; color: var(--accent); font-weight: 600; }
.product-card__actions { padding: 12px 14px; border-top: 1px solid var(--gray-100); display: flex; gap: 8px; }
.product-card__actions .btn { flex: 1; font-size: .82rem; padding: 8px 10px; }

/* ── Producto detalle ── */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.product-gallery { position: sticky; top: 80px; }
.product-gallery__main { aspect-ratio: 1; background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 12px; }
.product-gallery__main img { width: 100%; height: 100%; object-fit: contain; padding: 20px; }
.product-info__brand { font-size: .8rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.product-info__name  { font-size: 1.6rem; font-weight: 700; color: var(--navy); line-height: 1.25; margin-bottom: 12px; }
.product-info__price { font-size: 2rem; font-weight: 800; color: var(--accent); margin-bottom: 8px; }
.product-info__price-desc { font-size: .9rem; color: var(--gray-600); margin-bottom: 20px; }
.product-info__sku  { font-size: .8rem; color: var(--gray-400); margin-bottom: 16px; }

/* Reseñas */
.reviews-section { margin-top: 48px; }
.reviews-section h2 { font-size: 1.3rem; color: var(--navy); margin-bottom: 20px; border-bottom: 2px solid var(--accent); padding-bottom: 8px; }
.review-card { background: var(--white); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.review-card__header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 8px; }
.review-card__author { font-weight: 600; font-size: .9rem; }
.review-card__date   { font-size: .78rem; color: var(--gray-400); }
.review-card__stars  { color: #f59e0b; letter-spacing: 2px; font-size: 1rem; }
.review-card__title  { font-weight: 600; margin-bottom: 4px; font-size: .92rem; }
.review-card__body   { font-size: .88rem; color: var(--gray-600); line-height: 1.5; }

.review-form { background: var(--white); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); margin-top: 24px; }
.review-form h3 { font-size: 1.1rem; color: var(--navy); margin-bottom: 16px; }
.stars-input { display: flex; flex-direction: row-reverse; gap: 4px; margin-bottom: 4px; }
.stars-input input { display: none; }
.stars-input label { font-size: 1.6rem; color: var(--gray-200); cursor: pointer; transition: color .1s; }
.stars-input input:checked ~ label,
.stars-input label:hover,
.stars-input label:hover ~ label { color: #f59e0b; }

/* ── Formularios ── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 5px; font-size: .87rem; font-weight: 600; color: var(--gray-800); }
.form-control { width: 100%; padding: 10px 14px; border: 1.5px solid var(--gray-200); border-radius: var(--radius); font-size: .9rem; font-family: inherit; transition: border-color var(--transition), box-shadow var(--transition); background: var(--white); color: var(--gray-800); }
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(30,139,195,.15); }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-error { color: var(--danger); font-size: .82rem; margin-top: 4px; }
.form-hint  { color: var(--gray-600); font-size: .8rem; margin-top: 3px; }

/* ── Alertas ── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: .9rem; border-left: 4px solid transparent; }
.alert--success { background: #f0fdf4; border-color: var(--success); color: #14532d; }
.alert--danger  { background: #fef2f2; border-color: var(--danger); color: #7f1d1d; }
.alert--warning { background: #fffbeb; border-color: var(--warning); color: #78350f; }
.alert--info    { background: #eff6ff; border-color: var(--accent); color: #1e3a5f; }

/* ── Page header ── */
.page-header { background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%); color: var(--white); padding: 40px 0; margin-bottom: 32px; }
.page-header h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 6px; }
.page-header p   { opacity: .8; font-size: .95rem; }
.breadcrumb { font-size: .8rem; color: rgba(255,255,255,.65); margin-bottom: 10px; }
.breadcrumb a { color: rgba(255,255,255,.8); }
.breadcrumb a:hover { color: var(--white); }
.breadcrumb span { margin: 0 6px; }

/* ── Filtros / Sidebar ── */
.catalog-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; align-items: start; }
.filters-panel { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px; position: sticky; top: 85px; }
.filters-panel h3 { font-size: .95rem; font-weight: 700; color: var(--navy); margin-bottom: 14px; border-bottom: 2px solid var(--accent); padding-bottom: 6px; }
.filter-group { margin-bottom: 20px; }
.filter-group label { font-size: .85rem; font-weight: 600; color: var(--gray-800); display: block; margin-bottom: 8px; }
.filter-option { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: .85rem; cursor: pointer; }
.filter-option input { accent-color: var(--accent); }

/* ── Paginación ── */
.pagination { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 32px; }
.pagination a, .pagination span { padding: 8px 14px; border-radius: var(--radius); font-size: .88rem; font-weight: 500; border: 1.5px solid var(--gray-200); color: var(--gray-800); transition: all var(--transition); }
.pagination a:hover  { background: var(--gray-100); border-color: var(--accent); color: var(--accent); }
.pagination .active  { background: var(--accent); border-color: var(--accent); color: var(--white); }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ── Admin Layout ── */
.admin-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.admin-sidebar { background: var(--navy); color: var(--white); padding: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-sidebar__brand { padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1); font-weight: 700; font-size: .95rem; color: var(--accent); }
.admin-sidebar__brand span { display: block; font-size: .72rem; color: rgba(255,255,255,.5); font-weight: 400; margin-top: 2px; }
.admin-sidebar nav ul li a { display: flex; align-items: center; gap: 10px; padding: 11px 20px; color: rgba(255,255,255,.75); font-size: .88rem; transition: background var(--transition), color var(--transition); border-left: 3px solid transparent; }
.admin-sidebar nav ul li a:hover,
.admin-sidebar nav ul li a.active { background: rgba(30,139,195,.2); color: var(--white); border-left-color: var(--accent); }
.admin-sidebar nav ul li a svg { flex-shrink: 0; }
.admin-main { padding: 28px; background: var(--gray-50); }
.admin-page-title { font-size: 1.4rem; font-weight: 700; color: var(--navy); margin-bottom: 24px; display: flex; align-items: center; gap: 10px; }
.admin-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.admin-card__title { font-size: 1rem; font-weight: 600; color: var(--navy); margin-bottom: 16px; border-bottom: 2px solid var(--gray-100); padding-bottom: 8px; }
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--gray-100); }
th { background: var(--gray-50); font-weight: 600; color: var(--gray-600); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
tr:hover td { background: var(--gray-50); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 50px; font-size: .72rem; font-weight: 600; letter-spacing: .04em; }
.badge--success { background: #dcfce7; color: #166534; }
.badge--danger  { background: #fee2e2; color: #991b1b; }
.badge--warning { background: #fef9c3; color: #713f12; }
.badge--info    { background: #dbeafe; color: #1e40af; }
.badge--gray    { background: var(--gray-200); color: var(--gray-600); }

/* Hamburger admin móvil */
.admin-hamburger { display: none; }
.admin-sidebar-overlay { display: none; }

/* ── Checkout ── */
.checkout-grid { display: grid; grid-template-columns: 1fr 380px; gap: 28px; align-items: start; }
.checkout-summary { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px; position: sticky; top: 85px; }
.checkout-summary__title { font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: 16px; }
.checkout-item { display: flex; gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.checkout-item img { width: 56px; height: 56px; object-fit: contain; background: var(--gray-100); border-radius: var(--radius); flex-shrink: 0; }
.checkout-totals { margin-top: 14px; }
.checkout-totals tr td:last-child { text-align: right; font-weight: 600; }
.checkout-totals .total-row td { font-size: 1.1rem; font-weight: 700; color: var(--accent); border-top: 2px solid var(--gray-200); padding-top: 10px; }

/* ── Footer ── */
.site-footer { background: var(--navy); color: rgba(255,255,255,.75); padding: 40px 0 20px; margin-top: 60px; }
.footer__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; margin-bottom: 28px; }
.footer__col h4 { color: var(--white); font-size: .9rem; font-weight: 700; margin-bottom: 14px; letter-spacing: .04em; }
.footer__col ul li { margin-bottom: 6px; }
.footer__col ul li a { color: rgba(255,255,255,.65); font-size: .85rem; transition: color var(--transition); }
.footer__col ul li a:hover { color: var(--accent); }
.footer__bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 16px; text-align: center; font-size: .78rem; color: rgba(255,255,255,.45); }

/* ── Responsive ── */
@media (max-width: 900px) {
    .header__inner { grid-template-columns: auto auto; }
    .header__search { display: none; }
    .btn-hamburger  { display: flex; }

    .site-nav { display: none; }
    .site-nav.open {
        display: block; position: fixed; top: 0; left: 0; width: 280px; height: 100vh;
        background: var(--navy); z-index: 600; overflow-y: auto; padding-top: 60px; box-shadow: var(--shadow-lg);
    }
    .nav__list { flex-direction: column; }
    .nav__list > li > a { padding: 14px 20px; color: rgba(255,255,255,.85); border-bottom: 1px solid rgba(255,255,255,.07); }
    .nav__submenu { position: static; display: none; background: rgba(255,255,255,.05); box-shadow: none; border-top: none; }
    .nav__dropdown.open .nav__submenu { display: block; }

    .catalog-layout { grid-template-columns: 1fr; }
    .product-detail { grid-template-columns: 1fr; }
    .product-gallery { position: static; }
    .checkout-grid  { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    /* Admin responsive */
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { position: fixed; left: -260px; width: 260px; top: 0; height: 100vh; z-index: 700; transition: left .25s; }
    .admin-sidebar.open { left: 0; }
    .admin-hamburger { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--navy); color: var(--white); font-weight: 600; font-size: .9rem; }
    .admin-hamburger button { color: var(--white); font-size: 1.3rem; }
    .admin-sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 690; opacity: 0; pointer-events: none; transition: opacity .2s; }
    .admin-sidebar-overlay.open { opacity: 1; pointer-events: all; }
    .admin-main { padding: 16px; }
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}

@media (max-width: 480px) {
    .topbar__inner { justify-content: center; font-size: .72rem; }
    .page-header h1 { font-size: 1.4rem; }
    .products-grid  { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .footer__grid   { grid-template-columns: 1fr; }
}

/* ── Spinner ── */
.spinner { width: 36px; height: 36px; border: 3px solid var(--gray-200); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Skeleton ── */
.skeleton { background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }
