/* ═════════════════════════════════════════════════════════════════
   COMMON.CSS - Estilos Compartidos Globales
   Usado por: index.html, proceso-compra.html, admin
   ═════════════════════════════════════════════════════════════════ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --purple: #7f1f6e;
    --purple-light: #a01f8a;
    --yellow: #F3E93F;
    --white: #ffffff;
    --gray-light: #f5f5f5;
    --gray-text: #7a8794;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #fafbfc;
    color: #2c3e50;
    line-height: 1.6;
}

/* ═════════════════════════════════════════════════════════════════
   HEADER COMPARTIDO
   ═════════════════════════════════════════════════════════════════ */

header {
    background-color: var(--white);
    padding: 18px 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 40px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logo-container:hover {
    transform: scale(1.05);
}

.logo {
    width: 70px;
    height: 70px;
    border-radius: 12px;
    background-image: url('../assets/logo.png');
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-weight: 700;
    font-size: 20px;
    box-shadow: 0 4px 16px rgba(127,31,110,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    flex-shrink: 0;
}

.logo:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(127,31,110,0.3);
}

.logo-text {
    display: none;
}

nav {
    display: flex;
    gap: 40px;
}

nav a {
    text-decoration: none;
    color: #5a5a5a;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

nav a:after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--yellow);
    transition: width 0.3s ease;
}

nav a:hover {
    color: var(--purple);
}

nav a:hover:after {
    width: 100%;
}

/* ═════════════════════════════════════════════════════════════════
   HAMBURGER MENU (Mobile)
   ═════════════════════════════════════════════════════════════════ */

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    z-index: 999;
}

.hamburger-btn:hover {
    transform: scale(1.1);
}

.mobile-nav {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 998;
}

.mobile-nav.open {
    display: block;
}

.mobile-nav-sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--white);
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    transition: left 0.3s ease;
    z-index: 999;
    padding-top: 80px;
}

.mobile-nav.open .mobile-nav-sidebar {
    left: 0;
}

.mobile-nav-sidebar a {
    display: block;
    padding: 16px 20px;
    text-decoration: none;
    color: #5a5a5a;
    font-weight: 500;
    font-size: 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
}

.mobile-nav-sidebar a:hover {
    background: var(--gray-light);
    color: var(--purple);
    padding-left: 24px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* ═════════════════════════════════════════════════════════════════
   GLOBAL SEARCH
   ═════════════════════════════════════════════════════════════════ */

.search-container {
    position: relative;
    width: 200px;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
    background-color: #f9f9f9;
}

.search-input:focus {
    outline: none;
    border-color: var(--purple);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(127, 31, 110, 0.1);
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-dropdown.active {
    display: block;
}

.search-section {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.search-section:last-child {
    border-bottom: none;
}

.search-section-title {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-result-item:hover,
.search-result-item.highlighted {
    background-color: #f9f9f9;
}

.search-result-thumbnail {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.search-result-text {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-size: 13px;
    font-weight: 500;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-type {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.search-no-results {
    padding: 20px 12px;
    text-align: center;
    font-size: 13px;
    color: #999;
}

.admin-link {
    background: none;
    border: none;
    color: #5a5a5a;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.admin-link:hover {
    color: var(--purple);
}

/* ═════════════════════════════════════════════════════════════════
   FOOTER COMPARTIDO
   ═════════════════════════════════════════════════════════════════ */

footer {
    background-color: #2c3e50;
    color: var(--white);
    padding: 30px 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 60px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}

.footer-logo {
    width: 32px;
    height: 32px;
    background: url('../assets/logo.png') center / cover no-repeat;
    background-color: var(--white);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 16px;
}

/* ═════════════════════════════════════════════════════════════════
   ANNOUNCEMENT BAR
   ═════════════════════════════════════════════════════════════════ */

.announcement-bar {
    background-color: var(--purple);
    color: var(--white);
    text-align: center;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 400;
}

/* ═════════════════════════════════════════════════════════════════
   BOTONES GLOBALES
   ═════════════════════════════════════════════════════════════════ */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
}

.btn-primary {
    background-color: var(--purple);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--purple-light);
}

.btn-secondary {
    background-color: var(--gray-light);
    color: var(--gray-text);
}

.btn-secondary:hover {
    background-color: #ddd;
}

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

.btn-success:hover {
    background-color: #229954;
}

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

.btn-danger:hover {
    background-color: #c0392b;
}

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

.btn-info:hover {
    background-color: #2980b9;
}

.btn-small {
    padding: 8px 12px;
    font-size: 12px;
}

/* ═════════════════════════════════════════════════════════════════
   FORMULARIOS
   ═════════════════════════════════════════════════════════════════ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--purple);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(127,31,110,0.1);
}

/* ═════════════════════════════════════════════════════════════════
   NOTIFICACIONES (TOAST)
   ═════════════════════════════════════════════════════════════════ */

.toast {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: var(--purple);
    color: var(--white);
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease;
    z-index: 10000;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ═════════════════════════════════════════════════════════════════
   MODAL
   ═════════════════════════════════════════════════════════════════ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.45);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 15px;
    padding: 40px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    margin: auto;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-text);
}

/* ═════════════════════════════════════════════════════════════════
   UTILIDADES
   ═════════════════════════════════════════════════════════════════ */

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

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-40 {
    margin-top: 40px;
}

.mb-40 {
    margin-bottom: 40px;
}

/* ═════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    header {
        padding: 12px 20px;
        flex-direction: row;
        gap: 10px;
    }

    .header-left {
        width: auto;
        gap: 20px;
    }

    nav {
        display: none !important;
    }

    .hamburger-btn {
        display: flex !important;
    }

    /* El buscador queda como ícono y se expande al tocarlo,
       así no tapa el logo centrado del header. */
    .search-container {
        width: 36px;
        flex: 0 0 36px;
        transition: width 0.25s ease, flex-basis 0.25s ease;
    }

    .search-container::before {
        content: '🔍';
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        font-size: 15px;
        pointer-events: none;
        z-index: 1;
    }

    .search-input {
        height: 36px;
        padding: 0;
        border-radius: 50%;
        background-color: transparent;
        border-color: transparent;
        color: transparent;
        cursor: pointer;
    }

    .search-input::placeholder {
        color: transparent;
    }

    .search-container:focus-within {
        width: 190px;
        flex: 0 0 190px;
    }

    header:has(.search-container:focus-within) .logo-container {
        opacity: 0;
    }

    .search-container:focus-within::before {
        opacity: 0;
    }

    .search-container:focus-within .search-input {
        padding: 0 12px;
        border-radius: 6px;
        background-color: #f9f9f9;
        border-color: #e0e0e0;
        color: #333;
        cursor: text;
    }

    .search-container:focus-within .search-input::placeholder {
        color: #999;
    }

    .search-dropdown {
        left: auto;
        right: 0;
        min-width: 240px;
    }

    footer {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .modal-content {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    header {
        position: relative !important;
        padding: 8px 12px !important;
        display: flex !important;
        align-items: center !important;
        min-height: 50px;
    }

    .hamburger-btn {
        display: flex !important;
        width: 32px !important;
        height: 32px !important;
        font-size: 24px !important;
        flex: 0 0 32px !important;
        position: relative;
        z-index: 2;
    }

    .logo-container {
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        z-index: 1;
    }

    .logo {
        width: 40px !important;
        height: 40px !important;
        font-size: 16px !important;
        flex-shrink: 0;
    }

    .logo-text {
        display: none !important;
    }

    .header-left {
        display: none !important;
    }

    nav {
        display: none !important;
    }

    nav a {
        font-size: 11px !important;
        flex: 0 1 auto !important;
        white-space: nowrap !important;
        text-align: center !important;
        padding: 6px 8px !important;
    }

    nav a:after {
        bottom: -2px !important;
    }

    .header-right {
        display: flex !important;
        gap: 10px !important;
        align-items: center !important;
        flex: 0 0 auto !important;
        margin-left: auto !important;
        position: relative;
        z-index: 2;
    }

    .admin-link {
        font-size: 16px !important;
        padding: 0 !important;
    }

    .cart-btn {
        font-size: 18px !important;
    }

    .announcement-bar {
        font-size: 10px !important;
        padding: 4px 12px !important;
        letter-spacing: 0;
        word-break: break-word;
    }

    footer {
        padding: 16px 12px !important;
        font-size: 11px !important;
    }

    .modal-content {
        padding: 12px !important;
        max-width: 100% !important;
        border-radius: 12px 12px 0 0 !important;
    }

    .btn,
    .btn-primary,
    .btn-secondary {
        padding: 10px 16px !important;
        font-size: 12px !important;
    }

    .form-group label {
        font-size: 12px !important;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 13px !important;
        padding: 10px !important;
    }

    .toast {
        font-size: 12px !important;
        padding: 12px 16px !important;
        bottom: 20px !important;
        right: 12px !important;
        left: 12px !important;
    }
}

@media (max-width: 360px) {
    nav {
        gap: 4px !important;
        font-size: 10px !important;
    }

    nav a {
        font-size: 10px !important;
        padding: 4px 6px !important;
    }
}



/* ===== Zona de texto con movimiento (marquesina) =====
   El texto se repite en dos grupos iguales y la pista se desplaza la mitad de su ancho, así el bucle no tiene saltos.
   La duración la calcula el JS según el largo del texto y la velocidad elegida en el panel. */
@keyframes scroll-left {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.marquee-track {
  display: inline-flex;
  white-space: nowrap;
  will-change: transform;
  animation: scroll-left 30s linear infinite;
}

.marquee-group {
  display: inline-flex;
  flex-shrink: 0;
}

.marquee-item {
  padding: 0 2.5rem;
}
