/* ============================================
   QVATEC-SHOP - TEMAS OSCURO/CLARO
   Versión con carrito corregido y menú alineado
============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ===== VARIABLES DEL TEMA CLARO (por defecto) ===== */
:root {
    /* Colores principales */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #059669;
    --secondary-dark: #047857;
    --secondary-light: #10b981;
    --accent: #f59e0b;
    --accent-dark: #d97706;
    --accent-light: #fbbf24;
    
    /* Colores de fondo */
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --bg-light: #f9fafb;
    --bg-dark: #e5e7eb;
    --bg-header: #ffffff;
    --bg-footer: #ffffff;
    --bg-dropdown: #ffffff;
    
    /* Colores de texto */
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --text-inverse: #ffffff;
    --text-link: #2563eb;
    --text-link-hover: #1d4ed8;
    
    /* Colores de estado */
    --success: #059669;
    --success-light: #d1fae5;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #dbeafe;
    
    /* Bordes y sombras */
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --border-dark: #d1d5db;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --border-radius: 0.75rem;
    --border-radius-sm: 0.5rem;
    --border-radius-lg: 1rem;
    --transition: all 0.3s ease;
}

/* ===== VARIABLES DEL TEMA OSCURO ===== */
[data-theme="dark"] {
    /* Colores principales */
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --secondary: #10b981;
    --secondary-dark: #059669;
    --secondary-light: #34d399;
    --accent: #fbbf24;
    --accent-dark: #f59e0b;
    --accent-light: #fcd34d;
    
    /* Colores de fondo */
    --bg-body: #111827;
    --bg-card: #1f2937;
    --bg-light: #374151;
    --bg-dark: #4b5563;
    --bg-header: #1f2937;
    --bg-footer: #1f2937;
    --bg-dropdown: #374151;
    
    /* Colores de texto */
    --text-primary: #f9fafb;
    --text-secondary: #e5e7eb;
    --text-muted: #9ca3af;
    --text-inverse: #111827;
    --text-link: #60a5fa;
    --text-link-hover: #93c5fd;
    
    /* Colores de estado */
    --success: #34d399;
    --success-light: #064e3b;
    --danger: #f87171;
    --danger-light: #7f1d1d;
    --warning: #fbbf24;
    --warning-light: #78350f;
    --info: #60a5fa;
    --info-light: #1e3a8a;
    
    /* Bordes y sombras */
    --border-color: #374151;
    --border-light: #4b5563;
    --border-dark: #6b7280;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.6);
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    box-shadow: var(--shadow);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.theme-toggle:hover {
    transform: rotate(180deg) scale(1.1);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.3);
}

#theme-icon {
    color: white;
}

[data-theme="dark"] .theme-toggle {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

/* ===== CART BUTTON - CORREGIDO (VERSIÓN QUE FUNCIONA) ===== */
.cart-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
}

.cart-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem !important;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    background: transparent;
    text-decoration: none;
}

.cart-link i {
    font-size: 1.25rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.cart-link:hover i {
    color: var(--primary);
}

/* ===== CART COUNT - VERSIÓN ORIGINAL (BIEN VISIBLE) ===== */
.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    background-color: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 1px solid var(--bg-card);
    line-height: 1;
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .cart-count {
    border-color: var(--bg-card);
}

/* ===== CART BUTTON EN RESPONSIVE - VERSIÓN ORIGINAL ===== */
@media (max-width: 992px) {
    .cart-item {
        margin-left: 0;
        width: auto;
    }
    
    .cart-link {
        width: auto;
        padding: 0.5rem 0.75rem !important;
    }
}

@media (max-width: 768px) {
    .cart-link {
        padding: 0.5rem 0.75rem !important;
    }
    
    .cart-count {
        top: -3px;
        right: -3px;
    }
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.2s ease;
}

a {
    text-decoration: none;
    color: var(--text-link);
    transition: var(--transition);
}

a:hover {
    color: var(--text-link-hover);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===== TOP BAR ===== */
.top-bar {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 0.75rem 0;
    border-bottom: 2px solid var(--accent);
}

.top-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
}

.top-bar-message i {
    color: white;
}

.top-bar-social {
    display: flex;
    gap: 1rem;
}

.top-bar-social .social-link {
    color: white;
    font-size: 1rem;
    transition: var(--transition);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-bar-social .social-link:hover {
    background: white;
    color: var(--primary);
    transform: translateY(-2px);
}

/* ===== HEADER / NAVIGATION ===== */
.header {
    background-color: var(--bg-header);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text span {
    background: linear-gradient(135deg, var(--secondary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.navbar-nav {
    gap: 0.5rem;
    display: flex;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem !important;
    color: var(--text-secondary) !important;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    height: 40px;
    line-height: 1;
}

.nav-link i {
    font-size: 1rem;
    color: var(--primary);
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary) !important;
    background-color: var(--bg-light);
}

.nav-link:hover i,
.nav-link.active i {
    color: var(--primary);
}

[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link.active {
    background-color: var(--bg-light);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: 2px solid var(--accent);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar i {
    color: white;
    font-size: 1rem;
}

.btn-register {
    background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
    color: white !important;
    border: 2px solid var(--accent) !important;
}

.btn-register i {
    color: white !important;
}

.btn-register:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.dropdown-menu {
    background-color: var(--bg-dropdown) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius);
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    color: var(--text-secondary) !important;
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.dropdown-item i {
    width: 20px;
    color: var(--primary);
}

.dropdown-item:hover {
    background-color: var(--bg-light) !important;
    color: var(--primary) !important;
}

.dropdown-divider {
    border-top-color: var(--border-color) !important;
}

/* ===== MESSAGES ===== */
.messages-container {
    padding: 1rem 0;
}

.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease;
    border-left: 4px solid;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert i {
    font-size: 1.25rem;
}

.alert-success {
    background-color: var(--success-light);
    color: var(--success);
    border-left-color: var(--success);
}

.alert-error {
    background-color: var(--danger-light);
    color: var(--danger);
    border-left-color: var(--danger);
}

.alert-warning {
    background-color: var(--warning-light);
    color: var(--warning);
    border-left-color: var(--warning);
}

.alert-info {
    background-color: var(--info-light);
    color: var(--info);
    border-left-color: var(--info);
}

.btn-close {
    filter: none;
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 1;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    background-color: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 0.25rem;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-label {
    color: var(--text-secondary);
    cursor: pointer;
}

.form-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ===== CARDS ===== */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-light);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-light);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.card-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
}

.badge-primary {
    background-color: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background-color: var(--success-light);
    color: var(--success);
}

.badge-danger {
    background-color: var(--danger-light);
    color: var(--danger);
}

.badge-warning {
    background-color: var(--warning-light);
    color: var(--warning);
}

.badge-info {
    background-color: var(--info-light);
    color: var(--info);
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.page-link:hover,
.page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ===== FOOTER ===== */
.footer {
    background-color: var(--bg-footer);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.footer-logo img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.footer-logo span {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.footer-logo span span {
    color: var(--primary);
}

.footer-description {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.footer-social {
    display: flex;
    gap: 0.75rem;
}

.footer-social .social-link {
    width: 36px;
    height: 36px;
    background-color: var(--bg-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.footer-social .social-link:hover {
    background-color: var(--primary);
    color: white;
    transform: translateY(-3px);
    border-color: var(--primary);
}

.footer-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.footer-links a i {
    font-size: 0.75rem;
    color: var(--primary);
}

.footer-links a:hover {
    color: var(--primary);
    transform: translateX(5px);
}

.footer-contact {
    list-style: none;
}

.footer-contact li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.footer-contact li i {
    width: 20px;
    color: var(--primary);
}

.footer-contact a {
    color: var(--text-muted);
    transition: var(--transition);
}

.footer-contact a:hover {
    color: var(--primary);
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-bottom-links {
    display: flex;
    gap: 1.5rem;
}

.footer-bottom-links a {
    color: var(--text-muted);
    transition: var(--transition);
}

.footer-bottom-links a:hover {
    color: var(--primary);
}

/* ===== UTILITY CLASSES ===== */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.bg-gradient {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.shadow-hover {
    transition: var(--transition);
}

.shadow-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .navbar-nav {
        align-items: flex-start;
    }
    
    .nav-link {
        height: auto;
        width: 100%;
    }
    
    .theme-toggle {
        margin: 0.5rem 0;
    }
}

@media (max-width: 768px) {
    .top-bar-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .navbar-brand {
        margin-right: 0;
    }
    
    .nav-link {
        padding: 0.75rem !important;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-bottom-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .card-header,
    .card-body,
    .card-footer {
        padding: 1rem;
    }
}