/* base.css - Reset, body, html, buttons base, animated background base */
*, *::before, *::after { box-sizing: border-box; }

/* Variables centralizadas: ver css/variables.css */
/* Variables centralizadas: ver css/variables.css */

/* =============================================================
   CORRECCION GLOBAL DE BOTONES - Evitar crecimiento al hacer clic
   ============================================================= */

/* Todos los botones: posicion relativa + overflow hidden para contener el ripple */
button, .btn, input[type="button"], input[type="submit"], input[type="reset"] {
    transform: none !important;
    box-shadow: none !important;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
}

.btn-success {
    background-color: #198754;
    border-color: #198754;
    color: #fff !important;
}
.btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
    color: #fff !important;
}

/* Estados activo/focus: sin transform que cambie el tamano */
button:active, .btn:active, button:focus, .btn:focus,
.btn-primary:active, .btn-secondary:active, .btn-success:active, .btn-danger:active,
.btn-warning:active, .btn-info:active, .btn-light:active, .btn-dark:active,
.btn-outline-primary:active, .btn-outline-secondary:active,
.btn-outline-warning:active, .btn-outline-info:active, .btn-outline-success:active,
.btn-outline-danger:active, .btn-outline-light:active, .btn-outline-dark:active,
input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active {
    transform: none !important;
    box-shadow: none !important;
}

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 10000;
    padding: 0.5rem 1rem;
    background: var(--primary, #8a2be2);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}
.skip-link:focus {
    top: 0;
}

/* Ripple effect: DEBE ser position:absolute para NO alterar el tamano del boton */
.ripple {
    position: absolute !important;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    pointer-events: none;
    transform: scale(0);
    animation: ripple-expand 0.6s linear;
    width: 0;
    height: 0;
    z-index: 0;
}

@keyframes ripple-expand {
    to {
        transform: scale(4);
        opacity: 0;
    }
}


body {
    font-family: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding-top: 70px;
    background-color: var(--light-gray) !important;
    color: var(--dark);
    position: relative;
    overflow-x: hidden;
    margin: 0;
}

/* Fondo animado */
#animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background: var(--light-gray);
}

/* === Utility Classes (replacing Bootstrap) === */
.d-none { display: none !important; }
.hidden { display: none !important; }
.flex { display: flex; }
.d-flex { display: flex !important; }
.flex-col { flex-direction: column; }
.flex-center { align-items: center; }
.flex-between { justify-content: space-between; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-start { justify-content: flex-start !important; }
.justify-content-end { justify-content: flex-end !important; }
.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }
.flex-wrap { flex-wrap: wrap !important; }
.text-center { text-align: center !important; }
.text-muted { color: #6c757d !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.overflow-hidden { overflow: hidden; }
.h5 { font-size: 1.25rem; font-weight: 600; }
.p-0 { padding: 0 !important; }
.pe-4 { padding-right: 1.5rem !important; }
.position-relative { position: relative; }
.w-100 { width: 100% !important; }

/* Spacing utilities */
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-2 { margin-top: 0.5rem; }
.mt-5 { margin-top: 3rem; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-5 { padding-top: 3rem; padding-bottom: 3rem; }

/* Spinner */
.spinner {
    width: 2rem;
    height: 2rem;
    border: 0.25em solid var(--light-gray);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

/* Bootstrap-compat classes (used by JS dynamic rendering, replaced in Phase 5) */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -15px;
    margin-right: -15px;
}
.row.g-0 { gap: 0; margin-left: 0; margin-right: 0; }
.row.g-0 > [class*="col-"] { padding-left: 0; padding-right: 0; }

[class*="col-"] {
    padding-left: 15px;
    padding-right: 15px;
}

.col-12 { flex: 0 0 100%; max-width: 100%; }

@media (min-width: 576px) {
    .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
}

@media (min-width: 768px) {
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-md-9 { flex: 0 0 75%; max-width: 75%; }
}

@media (min-width: 992px) {
    .col-lg-2 { flex: 0 0 16.66667%; max-width: 16.66667%; }
    .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
    .col-lg-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
}

.card { background: #fff; border: none; border-radius: var(--border-radius); }
.card-body { padding: 1rem; }
.h-100 { height: 100%; }
.card-title { font-weight: 600; color: var(--dark); margin-bottom: 0.5rem; }

/* Grid item for products */
.grid-item { margin-bottom: 0; }

/* Margin/padding utilities used by JS rendering */
.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }
.me-3 { margin-right: 1rem; }
.ms-2 { margin-left: 0.5rem; }
.ms-auto { margin-left: auto; }
.mt-3 { margin-top: 1rem; }
.fw-bold { font-weight: 700; }

/* Badge (used by JS detail view) */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: 0.375rem;
}
.bg-light { background: #f8f9fa; }
.bg-warning { background: #ffc107; }
.text-dark { color: #2D1B69; }
.text-warning { color: #ffc107; }

/* Carousel (minimal, Bootstrap JS renders it) */
.carousel { position: relative; }
.carousel-inner { position: relative; overflow: hidden; width: 100%; }
.carousel-item { position: relative; display: none; float: left; width: 100%; }
.carousel-item.active { display: block; }
.carousel-control-prev, .carousel-control-next {
    position: absolute; top: 50%; transform: translateY(-50%);
    z-index: 5; display: flex; align-items: center; justify-content: center;
    width: 15%; padding: 0; color: #fff; text-align: center;
    background: none; border: none; opacity: 0.5; cursor: pointer;
}
.carousel-control-prev { left: 0; }
.carousel-control-next { right: 0; }
.carousel-control-prev-icon, .carousel-control-next-icon {
    display: inline-block; width: 2rem; height: 2rem;
    background: rgba(0,0,0,0.3) no-repeat 50%/100% 100%;
    border-radius: 50%;
}
.carousel-control-prev-icon { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M11.354 1.646a.5.5 0 010 .708L5.707 8l5.647 5.646a.5.5 0 01-.708.708l-6-6a.5.5 0 010-.708l6-6a.5.5 0 01.708 0z'/%3e%3c/svg%3e"); }
.carousel-control-next-icon { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M4.646 1.646a.5.5 0 01.708 0l6 6a.5.5 0 010 .708l-6 6a.5.5 0 01-.708-.708L10.293 8 4.646 2.354a.5.5 0 010-.708z'/%3e%3c/svg%3e"); }
.carousel-control-prev:hover, .carousel-control-next:hover { opacity: 1; }

/* Also define visually-hidden for Bootstrap JS compat */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* Modal Bootstrap JS compat */
.modal { display: none; position: fixed; z-index: 1055; left: 0; top: 0; width: 100%; height: 100%; overflow-x: hidden; overflow-y: auto; outline: 0; }
.modal.show { display: block; }
.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; top: 0; left: 0; z-index: 1050; width: 100vw; height: 100vh; background: rgba(0,0,0,0.5); }
.modal-backdrop.fade { opacity: 0; transition: opacity 0.15s linear; }
.modal-backdrop.show { opacity: 1; }
.modal-dialog { position: relative; width: auto; margin: 0.5rem; pointer-events: none; max-width: 500px; margin: 1.75rem auto; }
.modal-dialog-centered { display: flex; align-items: center; min-height: calc(100% - 1rem); }
.modal-content { position: relative; display: flex; flex-direction: column; width: 100%; pointer-events: auto; background: #fff; border-radius: var(--border-radius); box-shadow: var(--shadow-xl); outline: 0; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem; border-bottom: 1px solid #dee2e6; background: var(--gradient-primary); color: #fff; border-radius: var(--border-radius) var(--border-radius) 0 0; }
.modal-title { margin: 0; font-size: 1.1rem; font-weight: 600; }
.modal-body { position: relative; flex: 1 1 auto; padding: 1rem; }
.modal-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid #dee2e6; }
.modal-xl { max-width: 1140px; }
@media (max-width: 576px) {
    .modal-fullscreen-sm-down { max-width: 100%; margin: 0; height: 100%; border-radius: 0; }
}

/* Close button (replacing btn-close) */
.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: white;
    opacity: 0.8;
    cursor: pointer;
    padding: 0;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.close-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Native <dialog> styles */
.frontend-dialog {
    border: none;
    border-radius: var(--border-radius);
    padding: 0;
    max-width: 500px;
    width: 90vw;
    box-shadow: var(--shadow-xl);
    background: #fff;
    overscroll-behavior: contain;
}
.frontend-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
}
.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--gradient-primary);
    color: #fff;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}
.dialog-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}
.dialog-body {
    padding: 1rem;
}
.dialog-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid #dee2e6;
}

/* CSS Tooltips (replaces Bootstrap Tooltip) */
[data-bs-tooltip="tooltip"] {
    position: relative;
}
[data-bs-tooltip="tooltip"]::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: #333;
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 1000;
}
[data-bs-tooltip="tooltip"]:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Form controls */
.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
    color: #444;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(138,43,226,0.15);
}
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

/* Form check (inline checkbox) */
.form-check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-right: 1rem;
    cursor: pointer;
    font-size: 0.9rem;
}
.form-check-input {
    width: 1em;
    height: 1em;
    accent-color: var(--primary);
    cursor: pointer;
}
.form-check-label {
    cursor: pointer;
}

/* Category buttons */
.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}
.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}
.btn-outline-secondary {
    border: 2px solid #6c757d;
    color: #6c757d;
    background: transparent;
}
.btn-outline-secondary:hover {
    background: #6c757d;
    color: #fff;
}
