/* ============================================
   VARIABLES GLOBALES
============================================ */
:root {
    --ml-yellow: #fff159;
    --ml-blue: #3483fa;
    --bg: #ebebeb;
    --text-dark: #333;
}

/* ============================================
   RESET UNIVERSAL
============================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
}

html {
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
}

body {
    background: var(--bg);
    padding-top: 150px;
    color: var(--text-dark);
    min-height: 100vh;
}

/* Admin: sin padding-top en el body */
body:has(.admin-header) {
    padding-top: 0 !important;
}

/* Login: centrado vertical */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: #ededed;
    padding-top: 0 !important;
}

body.modal-open {
    overflow: hidden;
}

hr {
    margin: 20px 0;
    border: none;
    border-top: 1px solid #ddd;
}

/* ============================================
   HEADER FIJO
============================================ */
.header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--ml-yellow);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-top {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
    flex-shrink: 0;
}

.logo-brand img {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: white;
    border: 2px solid white;
    object-fit: cover;
}

.brand-info {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    margin-left: 10px;
}

.brand-name {
    font-size: 1.6rem;
    font-weight: 800;
}

.brand-slogan {
    font-size: 0.9rem;
    text-transform: uppercase;
}

.search-box {
    flex-grow: 1;
    display: flex;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    height: 45px;
}

.search-box input {
    border: none;
    padding: 0 15px;
    width: 100%;
    outline: none;
    font-size: 16px;
}

.search-box button {
    border: none;
    background: white;
    padding: 0 15px;
    cursor: pointer;
    color: var(--ml-blue);
}

/* ============================================
   NAVEGACIÓN
============================================ */
.nav-bar {
    background: var(--ml-yellow);
    position: relative;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
}

.menu-toggle {
    display: none;
}

.nav-menu {
    display: flex;
    justify-content: center;
    gap: 25px;
    padding: 0 15px 10px 15px;
    flex-wrap: wrap;
}

.nav-menu a {
    text-decoration: none;
    color: #333;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s;
}

.nav-menu a:hover {
    color: var(--ml-blue);
}

/* ============================================
   GRID DE PRODUCTOS (index.php, buscar.php)
============================================ */
.main-content {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 15px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.img-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.info {
    padding: 15px;
    border-top: 1px solid #f5f5f5;
}

.price {
    font-size: 1.5rem;
    font-weight: 600;
}

.name {
    font-size: 1rem;
    color: #666;
    height: 40px;
    overflow: hidden;
}

.search-results-title {
    margin-bottom: 20px;
    color: #333;
}

/* ============================================
   BADGE DE ESTADO DEL PRODUCTO
============================================ */
.product-status {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #e60000;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    pointer-events: none;
}

/* ============================================
   MODAL TARJETA PERSONAL (index.php)
============================================ */
#modal-personal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    overflow: hidden;
}

#modal-personal img {
    max-width: 90%;
    max-height: 80%;
    border: 3px solid #fff;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(255,255,255,0.2);
}

.btn-cerrar-modal {
    margin-top: 20px;
    padding: 12px 30px;
    background: #fff159;
    color: #333;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1.1rem;
}

/* ============================================
   PÁGINA DE PRODUCTO (producto.php)
============================================ */
.product-container {
    max-width: 1180px;
    margin: 0 auto 40px auto;
    background: white;
    border-radius: 8px;
    display: flex;
    padding: 20px;
    gap: 20px;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,.1);
}

.left-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.images-section {
    display: flex;
    gap: 15px;
}

.thumbnails {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.thumb {
    width: 50px;
    height: 50px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    object-fit: contain;
    padding: 2px;
}

.thumb:hover,
.thumb.active {
    border: 2px solid #3483fa;
}

.main-img-container {
    flex: 1;
    text-align: center;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.main-img-container img {
    max-width: 100%;
    max-height: 520px;
    object-fit: contain;
}

.description-area {
    margin-top: 50px;
    padding-top: 40px;
    border-top: 1px solid #eee;
}

.description-title {
    font-size: 24px;
    color: #333;
    margin-bottom: 25px;
    font-weight: 400;
}

.description-text {
    font-size: 20px;
    color: #666;
    line-height: 1.6;
    white-space: pre-wrap;
}

.buy-side {
    width: 360px;
}

.buy-box {
    border: 1px solid #edeff2;
    border-radius: 8px;
    padding: 24px;
    position: sticky;
    top: 140px;
    background: white;
}

.status-label {
    display: inline-block;
    font-size: 14px;
    color: white;
    background: #e60000;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.product-title {
    font-size: 26px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    margin-bottom: 15px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

.price-tag {
    font-size: 44px;
    font-weight: 300;
    color: #333;
    margin-bottom: 25px;
}

.btn-wa-main {
    display: block;
    background: #3483fa;
    color: white;
    text-align: center;
    padding: 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 22px;
    transition: background 0.2s;
}

.btn-wa-main:hover {
    background: #2968ca;
}

.sku-container {
    margin-top: 30px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.sku-text {
    font-size: 14px;
    color: #666;
}

/* ============================================
   FOOTER
============================================ */
.site-footer {
    background: #00a650;
    color: white;
    padding: 15px 0;
    margin-top: 40px;
    font-size: 14px;
    width: 100%;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.footer-info p,
.footer-contacto p {
    margin: 5px 0;
    line-height: 1.5;
}

.footer-contacto a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    border-bottom: 1px solid rgba(255,255,255,0.3);
}

.footer-contacto a:hover {
    color: #fff159;
    border-bottom-color: #fff159;
}

.footer-legal {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.footer-legal a {
    color: white;
    text-decoration: none;
    margin: 0 15px;
    font-size: 14px;
    transition: color 0.2s;
    display: inline-block;
}

.footer-legal a:hover {
    color: #fff159;
    text-decoration: underline;
}

/* ============================================
   PANEL ADMIN (admin.php)
============================================ */
.admin-container {
    padding: 20px;
    max-width: 1200px;
    margin: 20px auto;
    background: white;
    border-radius: 8px;
}

.admin-header {
    background: var(--ml-yellow);
    padding: 10px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    top: 0;
}

.admin-header .header-top {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-header .logo-brand {
    color: #333;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

thead tr {
    background-color: #f2f2f2;
}

th,
td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.badge-sku {
    background-color: #e1f5fe;
    color: #01579b;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-family: monospace;
}

#codeOut {
    background-color: #e3f2fd;
    color: #0d47a1;
    font-weight: bold;
    border: 2px solid #2196f3;
    text-align: center;
}

.btn-save {
    background: #3483fa;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.btn-volver,
.btn-volver-admin {
    background: #fff159;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    border: 1px solid #e6d84d;
    display: inline-block;
}

.btn-volver {
    padding: 10px 15px;
    margin-bottom: 20px;
}

.btn-volver-admin {
    padding: 10px 20px;
    font-size: 1rem;
}

.btn-volver-admin:hover {
    background: #f3e55c;
}

.tabs-container {
    display: flex;
    gap: 5px;
    margin: 20px 0;
    border-bottom: 2px solid #ddd;
}

.tab {
    padding: 12px 25px;
    background: #f5f5f5;
    text-decoration: none;
    color: #666;
    border-radius: 8px 8px 0 0;
    border: 1px solid #ddd;
    border-bottom: none;
    font-weight: 600;
    transition: all 0.2s;
}

.tab:hover {
    background: #e8e8e8;
}

.tab.activo {
    background: white;
    color: #0056b3;
    border-bottom: 2px solid white;
    margin-bottom: -2px;
    position: relative;
}

.galeria-panel {
    background: white;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-bottom: 30px;
}

.imagenes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.imagen-item {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    background: #fafafa;
}

.imagen-item img {
    max-width: 100%;
    height: 120px;
    object-fit: contain;
    margin-bottom: 10px;
}

.principal-badge {
    display: inline-block;
    background: #00a650;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 8px;
}

.btn-eliminar-img {
    display: inline-block;
    background: #e60000;
    color: white;
    padding: 5px 10px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 5px;
}

.btn-eliminar-img:hover {
    background: #cc0000;
}

.mensaje-upload {
    margin: 15px 0;
    padding: 12px;
    background: #d4edda;
    color: #155724;
    border-radius: 4px;
    border-left: 4px solid #00a650;
}

.error-box {
    background: #ffebeb;
    color: #e60000;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #e60000;
}

.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: bold;
    margin-bottom: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}

/* ============================================
   LOGIN (login.php)
============================================ */
.login-card {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h2 {
    margin-bottom: 10px;
}

.login-card p {
    margin-bottom: 20px;
    color: #666;
}

.login-card input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 20px;
    outline: none;
    box-sizing: border-box;
}

.login-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.login-logo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff159;
}

.login-title h2 {
    color: #0056b3;
    font-size: 1.8rem;
    margin: 0;
}

.password-group {
    position: relative;
    margin-bottom: 20px;
}

.password-group input {
    width: 100%;
    padding: 14px 45px 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    box-sizing: border-box;
    font-size: 1rem;
}

.password-group input:focus {
    border-color: #3483fa;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 1.3rem;
    color: #666;
}

.btn-login {
    width: 100%;
    background: #3483fa;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    padding: 15px;
    font-size: 1rem;
}

.btn-primary {
    width: 100%;
    background: #3483fa;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    padding: 16px;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.btn-primary:hover {
    background: #2968ca;
}

.btn-link {
    display: block;
    text-align: center;
    color: #3483fa;
    text-decoration: none;
    padding: 10px;
    margin: 5px 0;
    border-radius: 4px;
}

.btn-link:hover {
    background: #f0f0f0;
    text-decoration: underline;
}

.btn-danger {
    color: #e60000;
}

.btn-danger:hover {
    background: #ffebeb;
}

.back-link {
    display: inline-block;
    margin-top: 20px;
    color: #3483fa;
    text-decoration: none;
}

.alert-error {
    background: #ffebeb;
    color: #e60000;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.info-box {
    background: #e3f2fd;
    color: #0d47a1;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

/* ============================================
   RESPONSIVE - MÓVIL (≤ 700px)
============================================ */
@media (max-width: 700px) {
    body {
        padding-top: 130px;
    }

    .grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    .card {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 10px;
    }

    .card .img-container {
        width: 100px;
        height: 100px;
        flex-shrink: 0;
        aspect-ratio: 1/1;
    }

    .card .info {
        flex: 1;
        padding: 0;
        border-top: none;
    }

    .card .name {
        font-size: 14px;
        font-weight: 600;
        height: auto;
        margin-bottom: 4px;
    }

    .card .description {
        font-size: 11px !important;
        margin: 3px 0 !important;
    }

    .card .price {
        font-size: 16px;
        font-weight: 700;
    }

    .card .info div[style*="font-size: 14px"] {
        font-size: 12px !important;
    }

    .product-status {
        font-size: 8px;
        padding: 2px 6px;
        top: 5px;
        left: 5px;
    }

    .menu-toggle {
        display: block;
        width: auto;
        padding: 12px 20px;
        margin: 10px 15px;
        background: #333;
        color: white;
        border: none;
        font-size: 1.1rem;
        font-weight: bold;
        cursor: pointer;
        border-radius: 4px;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        background: var(--ml-yellow);
        padding: 0;
        gap: 0;
        width: 100%;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu a {
        padding: 15px 20px;
        border-bottom: 1px solid rgba(0,0,0,0.05);
        width: 100%;
        text-align: left;
        font-size: 16px;
        white-space: normal;
    }

    .footer-legal a {
        display: block;
        margin: 8px 0;
    }

    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 15px;
    }

    .site-footer {
        padding: 12px 0;
        font-size: 13px;
    }

    .footer-info p,
    .footer-contacto p {
        margin: 3px 0;
    }

    .admin-header .header-top {
        flex-direction: column;
        gap: 10px;
    }

    .btn-volver-admin {
        width: 100%;
        text-align: center;
    }

    .form-row {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .reclamo-container {
        padding: 15px !important;
    }

    .reclamo-container h1 {
        font-size: 22px !important;
    }

    .btn-submit {
        padding: 14px !important;
        font-size: 17px !important;
    }
}

/* ============================================
   RESPONSIVE - TABLET/ESCRITORIO (≥ 701px)
============================================ */
@media (min-width: 701px) {
    .nav-menu {
        display: flex !important;
        flex-direction: row;
        justify-content: center;
        max-height: none;
        overflow-y: visible;
        background: transparent;
    }

    .menu-toggle {
        display: none !important;
    }

    .nav-menu a {
        font-size: 19px !important;
        font-weight: 500;
        display: flex;
        align-items: center;
    }

    .login-card p {
        font-size: 1.2rem !important;
    }

    .btn-login {
        font-size: 1.3rem !important;
        padding: 15px !important;
    }

    .back-link {
        font-size: 1.1rem !important;
    }

    .login-card input[type="password"] {
        font-size: 1.3rem !important;
        padding: 15px !important;
    }

    .login-card input[type="password"]::placeholder {
        font-size: 1.3rem !important;
    }

    .admin-container h2 {
        font-size: 2rem;
        color: #0056b3;
        margin-bottom: 25px;
    }

    .admin-container label,
    .admin-container input,
    .admin-container select,
    .admin-container textarea,
    .btn-save,
    .btn-volver {
        font-size: 1.1rem !important;
    }

    .admin-container table {
        font-size: 1.05rem;
    }

    .admin-container th,
    .admin-container td {
        padding: 15px;
    }
}

/* ============================================
   RESPONSIVE - TABLET MEDIA (701px – 1023px)
============================================ */
@media (min-width: 701px) and (max-width: 1023px) {
    .product-title {
        font-size: 28px !important;
    }

    .description-text {
        font-size: 17px !important;
    }

    .btn-wa-main {
        font-size: 18px !important;
    }
}

/* ============================================
   RESPONSIVE - ESCRITORIO COMPLETO (≥ 1024px)
============================================ */
@media (min-width: 1024px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }

    .product-title {
        font-size: 32px !important;
        line-height: 1.3;
    }

    .description-text {
        font-size: 18px !important;
        line-height: 1.6;
    }

    .btn-wa-main {
        font-size: 20px !important;
        padding: 18px !important;
    }

    .sku-text {
        font-size: 18px;
        font-weight: 500;
        color: #333;
    }

    .buy-box .product-description {
        font-size: 16px !important;
    }
}

/* ============================================
   RESPONSIVE - PRODUCTO EN PANTALLAS ≤ 1000px
============================================ */
@media (max-width: 1000px) {
    .product-container {
        flex-direction: column;
        padding: 10px;
    }

    .images-section {
        flex-direction: column-reverse;
    }

    .thumbnails {
        flex-direction: row;
        overflow-x: auto;
    }

    .buy-side {
        width: 100%;
    }

    .buy-box {
        position: static;
        border: none;
        padding: 10px 0;
    }
}

/* ============================================
   RESPONSIVE - LIBRO DE RECLAMACIONES (≤ 768px)
============================================ */
@media (max-width: 768px) {
    .reclamo-container {
        padding: 20px !important;
        margin: 15px !important;
    }

    .reclamo-container h1 {
        font-size: 24px !important;
    }

    .reclamo-container .reclamo-header p {
        font-size: 13px !important;
    }

    .aviso-legal {
        font-size: 12px !important;
        padding: 12px !important;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px !important;
        font-size: 16px !important;
    }

    .form-group label {
        font-size: 14px !important;
    }

    .reclamo-container h3 {
        font-size: 18px !important;
        margin: 20px 0 10px !important;
    }

    .btn-submit {
        padding: 16px !important;
        font-size: 18px !important;
        margin-top: 15px !important;
    }

    .info-adicional {
        font-size: 12px !important;
        margin-top: 20px !important;
        padding-top: 15px !important;
    }
}

/* ============================================
   RESPONSIVE - LIBRO DE RECLAMACIONES TABLET (769px – 1024px)
============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    .reclamo-container {
        max-width: 700px !important;
    }
}