/* =====================
   RESET & VARIABLES
   ===================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --orange: #FF6B35;
    --orange-dark: #E05520;
    --blue: #004E89;
    --blue-dark: #003A66;
    --blue-light: #F0F7FF;
    --white: #FFFFFF;
    --gray-100: #F8FAFC;
    --gray-200: #E2E8F0;
    --gray-400: #94A3B8;
    --gray-600: #475569;
    --text: #0F172A;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --glass: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.4);
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: var(--text);
    background: var(--gray-100);
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

.hidden {
    display: none !important;
}

/* =====================
   TOP BAR
   ===================== */
.top-bar {
    background: var(--white);
    border-bottom: 2px solid var(--orange);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: var(--shadow-sm);
}

.top-bar-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-top: 12px;
    padding-bottom: 12px;
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.logo-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.logo-img {
    height: 56px;
    width: auto;
    min-width: 0;
    display: block;
    object-fit: contain;
}

/* Ocultar el cuadrado blanco cuando la imagen no carga */
.logo-img:-moz-broken {
    display: none;
}

.footer-logo {
    height: 40px;
    min-width: 0;
    object-fit: contain;
}

.logo-placeholder {
    width: 52px;
    height: 52px;
    background: var(--blue);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    border-radius: var(--radius);
    letter-spacing: 1px;
}

/* Search */
.search-wrap {
    flex: 1;
    display: flex;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    max-width: 520px;
}

.search-input {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    border: none;
    outline: none;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
}

.search-input::placeholder {
    color: var(--gray-400);
}

.search-btn {
    background: var(--orange);
    color: var(--white);
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.search-btn:hover {
    background: var(--orange-dark);
}

/* Contact bar */
.contact-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-600);
    padding: 6px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s;
}

.contact-link:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.contact-link svg {
    flex-shrink: 0;
}

.whatsapp-link {
    color: #25D366;
    border-color: #25D366;
}

.whatsapp-link:hover {
    background: #25D366;
    color: var(--white);
}

.instagram-link {
    color: #C13584;
    border-color: #C13584;
}

.instagram-link:hover {
    background: #C13584;
    color: var(--white);
}

.facebook-link {
    color: #1877F2;
    border-color: #1877F2;
}

.facebook-link:hover {
    background: #1877F2;
    color: var(--white);
}

/* =====================
   CATEGORY NAV
   ===================== */
.category-nav {
    background: var(--blue);
    position: sticky;
    top: 78px;
    z-index: 100;
}

.nav-inner {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-inner::-webkit-scrollbar {
    display: none;
}

.nav-btn {
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 14px 22px;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}

.nav-btn:hover {
    color: var(--white);
    border-bottom-color: rgba(255, 255, 255, 0.4);
}

.nav-btn.active {
    color: var(--white);
    border-bottom-color: var(--orange);
}

/* =====================
   MAIN
   ===================== */
.main {
    padding: 32px 0 48px;
}

.section-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 24px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--blue);
}

.product-count {
    font-size: 13px;
    color: var(--gray-600);
}

/* =====================
   CATALOG GRID
   ===================== */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* Product Card */
.product-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s, transform 0.15s;
}

.product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.product-img-wrap {
    position: relative;
    background: var(--gray-100);
    height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Imagen no encontrada: mostrar ícono */
.product-img-wrap .img-fallback {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--gray-400);
    font-size: 13px;
}

.product-img-wrap .img-fallback svg {
    opacity: 0.4;
}

.product-category-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--orange);
    color: var(--white);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 2px;
    text-transform: uppercase;
}

.product-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 2px;
}

.product-meta {
    font-size: 12px;
    color: var(--gray-600);
    line-height: 1.4;
}

.product-meta .meta-label {
    font-weight: 600;
    color: var(--blue);
}

.product-meta code {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 11px;
    font-family: monospace;
    color: var(--text);
}

.product-modelos {
    font-size: 11px;
    color: var(--gray-600);
    border-top: 1px solid var(--gray-200);
    padding-top: 6px;
    margin-top: 2px;
}

.product-desc {
    font-size: 12px;
    color: var(--gray-600);
    line-height: 1.5;
    flex: 1;
}

.product-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--orange);
    color: var(--white);
    font-size: 13px;
    font-weight: 600;
    padding: 10px;
    border-radius: var(--radius);
    margin-top: 4px;
    transition: background 0.15s;
    text-align: center;
}

.product-cta:hover {
    background: var(--orange-dark);
}

/* No results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-600);
    font-size: 16px;
}

/* =====================
   CONTACT BANNER
   ===================== */
.contact-banner {
    background: var(--blue);
    padding: 40px 0;
}

.banner-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.banner-text h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 6px;
}

.banner-text p {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.75);
}

.banner-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.banner-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s;
    cursor: pointer;
    position: relative;
    z-index: 1;
    text-decoration: none;
}

.banner-btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.whatsapp-btn {
    background: #25D366;
    color: var(--white);
}

.email-btn {
    background: var(--white);
    color: var(--blue);
}

.email-btn:hover {
    background: var(--blue-light);
}

/* =====================
   FOOTER
   ===================== */
.footer {
    background: var(--blue-dark);
    padding: 24px 0;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

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

.footer-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 1px;
}

.footer-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.65);
    transition: color 0.15s;
}

.footer-links a:hover {
    color: var(--white);
}

.footer-copy {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    width: 100%;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 16px;
    margin-top: 8px;
}

/* =====================
   WHATSAPP FLOAT
   ===================== */
.whatsapp-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 54px;
    height: 54px;
    background: #25D366;
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
    z-index: 999;
    transition: transform 0.15s;
}

.whatsapp-float:hover {
    transform: scale(1.08);
}

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 900px) {
    .top-bar-inner {
        flex-wrap: wrap;
        gap: 12px;
    }

    .search-wrap {
        order: 3;
        max-width: 100%;
        width: 100%;
    }

    .contact-bar {
        order: 2;
    }

    .contact-link span {
        display: none;
    }

    .contact-link {
        padding: 8px;
    }
}

@media (max-width: 600px) {
    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .banner-inner {
        flex-direction: column;
        text-align: center;
    }

    .banner-actions {
        justify-content: center;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
    }
}

@media (max-width: 380px) {
    .catalog-grid {
        grid-template-columns: 1fr;
    }
}

/* =====================
   PANEL ADMINISTRACIÓN
   ===================== */
.admin-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

.admin-modal.hidden {
    opacity: 0;
    visibility: hidden;
    display: flex !important;
    pointer-events: none;
}

.admin-dialog {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    height: auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.admin-modal.hidden .admin-dialog {
    transform: scale(0.9) translateY(20px);
}

/* Pantallas internas del modal */
#adminLoginScreen,
#adminMainScreen {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    max-height: 90vh;
}


.admin-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 2px solid var(--orange);
    background: var(--blue);
    color: var(--white);
    flex-shrink: 0;
}

.admin-dialog-header h2 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.admin-close-btn {
    background: none;
    border: none;
    color: var(--white);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.admin-close-btn:hover {
    opacity: 1;
}

/* Login */
.admin-login-body {
    padding: 48px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background: linear-gradient(to bottom, var(--blue-light), var(--white));
}

.admin-lock-icon {
    font-size: 56px;
    margin-bottom: 8px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.admin-login-hint {
    font-size: 15px;
    color: var(--gray-600);
    text-align: center;
    max-width: 300px;
}

.admin-login-error {
    font-size: 13px;
    color: #ef4444;
    min-height: 20px;
    font-weight: 500;
    background: #fef2f2;
    padding: 4px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-login-error:empty {
    display: none;
}

/* Main panel */
.admin-main-body {
    flex: 1;
    /* Ocupa el espacio restante */
    min-height: 0;
    /* Permite que el flex se reduzca e inicie el scroll */
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.admin-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--blue);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

/* Form */
.admin-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.admin-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.admin-field-full {
    grid-column: 1 / -1;
}

.admin-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.required {
    color: var(--orange);
}

.admin-input {
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: all 0.2s ease;
    width: 100%;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.admin-input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 78, 137, 0.1);
}

.admin-textarea {
    resize: vertical;
    min-height: 72px;
}

.admin-hint {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 2px;
}

/* Dropzone Styles */
.admin-dropzone {
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: var(--gray-100);
    position: relative;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-dropzone:hover,
.admin-dropzone.dragover {
    border-color: var(--blue);
    background: var(--blue-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.dropzone-content svg {
    color: var(--blue);
    margin-bottom: 12px;
}

.dropzone-content p {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.dropzone-content span {
    font-size: 12px;
    color: var(--gray-400);
}

.dropzone-preview {
    width: 100%;
    position: relative;
}

.dropzone-preview img {
    max-height: 240px;
    max-width: 100%;
    border-radius: var(--radius);
    display: block;
    margin: 0 auto;
    object-fit: contain;
    box-shadow: var(--shadow-md);
}

.admin-btn-remove-img {
    position: absolute;
    top: -12px;
    right: -12px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
    z-index: 10;
}

.admin-btn-remove-img:hover {
    transform: scale(1.1);
    background: #dc2626;
}

.dropzone-preview.hidden,
.dropzone-content.hidden {
    display: none !important;
}

.admin-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.admin-btn-primary {
    background: var(--orange);
    color: var(--white);
    border: none;
    padding: 12px 28px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(255, 107, 53, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.admin-btn-primary:hover {
    background: var(--orange-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(255, 107, 53, 0.3);
}

.admin-btn-primary:active {
    transform: translateY(0);
}

.admin-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.admin-btn-secondary {
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1.5px solid var(--gray-200);
    padding: 10px 22px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.admin-btn-secondary:hover {
    background: var(--gray-200);
}

/* Table */
.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th {
    background: var(--blue);
    color: var(--white);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.admin-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: var(--gray-100);
}

.admin-actions-cell {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

.admin-btn-edit {
    background: var(--blue-light);
    color: var(--blue);
    border: 1px solid var(--blue);
    padding: 5px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.admin-btn-edit:hover {
    background: var(--blue);
    color: var(--white);
}

.admin-btn-del {
    background: #fff5f5;
    color: #e53e3e;
    border: 1px solid #e53e3e;
    padding: 5px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.admin-btn-del:hover {
    background: #e53e3e;
    color: var(--white);
}

@media (max-width: 600px) {
    .admin-form-grid {
        grid-template-columns: 1fr;
    }

    .admin-dialog {
        max-height: 95vh;
    }
}