/* ===========================
    VARIABLES GLOBALES
   =========================== */
:root {
    /* LIGHT */
    --main-background: #F4F6F8;
    --sidebar-header: #FFFFFF;
    --main-text: #333333;
    --secondary-text: #555555;
    --buttons: #3F51B5;
    --hover: #303F9F;
    --correct: #30d062;
    --warn: #f0e036;
    --error: #e02222;
}

/* Negro y tonos oscuros al activar modo oscuro */
:root:has(#toggle-mode:checked) {
    --main-background: #121212;
    --sidebar-header: #1E1E1E;
    --main-text: #E0E0E0;
    --secondary-text: #B0B0B0;
    --buttons: #7986CB;
    --hover: #5C6BC0;
}

/* ===========================
        RESET BÁSICO
   =========================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    background-color: var(--main-background);
    font-family: 'Poppins', sans-serif;
    color: var(--main-text);
    max-width: 100dvw;
    overflow-x: hidden;
}


/* ===========================
   HEADER Y SIDEBAR
   =========================== */
#toggle-menu,
#toggle-mode {
    display: none;
}

.menu-container {
    display: flex;
    justify-content: space-between;
    position: relative;
    background-color: var(--sidebar-header);
    border-bottom: 1px solid #000;
}

.material-symbols-outlined {
    color: var(--main-text);
    font-size: 1.5rem;
}

.menu-label,
.light-label {
    padding: 0.75rem;
    cursor: pointer;
}

.sidebar {
    width: 80dvw;
    position: absolute;
    top: 49px;
    right: -100%;
    background-color: var(--sidebar-header);
    transition: right 0.3s ease;
    z-index: 100;
    overflow-y: auto;
}

#toggle-menu:checked ~ .sidebar {
    right: 0;
}

.sidebar__list {
    display: flex;
    flex-direction: column;
    list-style: none;
    padding: 1rem;
    gap: 1rem;
}

.sidebar__list {
    display: flex;
    flex-direction: column;
    list-style: none;
    padding: 1rem;
}

.list__item {
    margin-bottom: 1rem;
}

.sidebar__link {
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    color: var(--main-text);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar__link i {
    font-size: 1.4rem;
}

#toggle-menu:checked ~ .sidebar {
    right: 0;
}

.sidebar__list {
    display: flex;
    flex-direction: column;
    list-style: none;
    padding: 1rem;
    gap: 1rem;
}

.sidebar__list {
    display: flex;
    flex-direction: column;
    list-style: none;
    padding: 1rem;
}

.list__item {
    margin-bottom: 1rem;
}

/* Actualiza los estilos del menú: */
.sidebar__link {
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    color: var(--main-text);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer; /* Añade cursor pointer */
}

/* Mantén el resto de tu CSS actual */

.sidebar__link a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
    width: 100%;
    pointer-events: none; /* Esto evita conflictos con el label */
}

.sidebar__link i {
    font-size: 1.4rem;
    user-select: none;
}

/* ===========================
   CONTENIDO PRINCIPAL
   =========================== */
.main-content {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
}

h1 {
    font-family: 'Montserrat', sans-serif;
    color: var(--main-text);
    letter-spacing: 2px;
}

/* ===========================
    SECCIÓN INICIO
   =========================== */

/* Cabecera de inicio: fecha y bienvenida */
.inicio-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 0 1rem;
}

.current-date {
    font-weight: 500;
    color: var(--secondary-text);
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
    text-transform: capitalize; /* Ej.: 'lunes, 01/06/2025' */
}

.welcome-title {
    font-family: 'Montserrat', sans-serif;
    color: var(--main-text);
    font-size: 1.8rem;
    letter-spacing: 1px;
    text-align: center;
}

/* Contenedor de tarjetas (cards) */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    justify-items: center;
    margin: 1rem auto;
    max-width: 1000px;
    padding: 0 1rem;
}

/* Cada tarjeta */
.card {
    background-color: var(--sidebar-header);
    border-radius: 0.5rem;
    padding: 1rem;
    width: 100%;
    max-width: 220px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    position: relative;
}

/* Título interno de tarjeta */
.card__title {
    font-family: 'Poppins', sans-serif;
    color: var(--main-text);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

/* SVG circular decorativo */
.card__chart {
    margin: 0 auto 0.5rem auto;
    transform: rotate(-90deg);
}

.card__chart circle {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 300;
    stroke-dashoffset: 300; /* animación desde 0% */
    transition: stroke-dashoffset 1s ease;
    animation: drawCircle 1.2s ease-out forwards;
}

/* Asignar color de trazo según posición de la tarjeta */
.card-container .card:nth-child(1) .card__chart circle {
    stroke: var(--correct);
    /* Ejemplo: simular 75% completado */
    stroke-dashoffset: 75;
}

.card-container .card:nth-child(2) .card__chart circle {
    stroke: var(--warn);
    /* Ejemplo: simular 50% completado */
    stroke-dashoffset: 150;
}

.card-container .card:nth-child(3) .card__chart circle {
    stroke: var(--error);
    /* Ejemplo: simular 90% completado */
    stroke-dashoffset: 30;
}

/* Valor numérico o texto destacado dentro de la tarjeta */
.card__value {
    font-family: 'Poppins', sans-serif;
    color: var(--main-text);
    font-size: 1.25rem;
    margin-top: 0.3rem;
    font-weight: 600;
}

/* ===========================
   VENTAS SEMANALES (Gráfico de barras)
   =========================== */
.weekly-sales {
    background-color: var(--sidebar-header);
    border-radius: 0.5rem;
    padding: 1rem;
    max-width: 1000px;
    margin: 2rem auto 3rem auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.weekly-sales__title {
    font-family: 'Poppins', sans-serif;
    color: var(--main-text);
    font-size: 1.1rem;
    margin-bottom: 0.6rem;
    text-align: center;
}

.weekly-sales__chart {
    display: block;
    margin: 0 auto;
    overflow: visible;
}

.weekly-sales__chart .bar {
    fill: var(--buttons);
    transition: fill 0.3s ease;
}

.weekly-sales__chart .bar:hover {
    fill: var(--hover);
}

.weekly-sales__labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.4rem;
    font-family: 'Poppins', sans-serif;
    color: var(--secondary-text);
    font-size: 0.85rem;
    padding: 0 1rem;
}

/* ===========================
   ANIMACIONES
   =========================== */
@keyframes drawCircle {
    from {
        stroke-dashoffset: 300;
    }
    to {
        stroke-dashoffset: 0;
    }
}

/* ===========================
   REGLAS GENERALES UNIENDO LO YA EXISTENTE
   =========================== */

/* Círculo base (si hay otros SVG fuera de cards) */
svg circle {
    fill: none;
    stroke: var(--buttons);
    stroke-linecap: round;
    stroke-width: 14;
    stroke-dasharray: 360;
    stroke-dashoffset: 30;
}

/* H1 principal */
h1 {
    font-family: 'Montserrat', sans-serif;
    color: var(--main-text);
    letter-spacing: 2px;
}

/* Sidebar ya declarado arriba */

/* Secciones por defecto ocultas, excepto la primera */
/* ===========================
   NAVEGACIÓN ENTRE SECCIONES (SOLUCIÓN FINAL)
   =========================== */
section {
    opacity: 0;
    display: none;
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1;
}

section:target {
    display: block;
    opacity: 1;
    pointer-events: auto;
    animation: fadeIn 0.4s ease;
    z-index: 2;
    position: relative;
}

/* Solo mostrar la primera sección cuando NO hay target en la URL */
body:not(:has(section:target)) section:first-of-type {
    display: block;
    opacity: 1;
    pointer-events: auto;
    position: relative;
    z-index: 2;
}

@keyframes fadeIn {
    from { 
        opacity: 0;
        transform: translateY(10px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}
/* ===========================
    MEDIA QUERIES PARA DESKTOP (min-width: 1024px)
   =========================== */
@media (min-width: 1024px) {
    /* Layout principal para desktop */
    body {
        display: grid;
        grid-template-columns: 250px 1fr;
        grid-template-rows: auto 1fr;
        grid-template-areas:
            "sidebar header"
            "sidebar content";
        min-height: 100vh;
    }

    .menu-container {
        grid-area: sidebar;
        display: flex;
        flex-direction: column;
        height: 100vh;
        position: sticky;
        top: 0;
        border-bottom: none;
        border-right: 1px solid rgba(0, 0, 0, 0.1);
    }


    :root:has(#toggle-mode:checked) .menu-container {
        border-right: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Ocultar el botón de menú en desktop */
    div .menu-label {
        display: none;
    }

    /* Sidebar para desktop */
    .menu-container {
        position: fixed;
    }
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        right: 0;
        top: 0;
        transition: none;
        overflow-y: auto;
        flex-grow: 1;
    }

    .sidebar__list {
        flex-direction: column;
        gap: 0.5rem;
    }

    .list__item {
        margin-bottom: 0.5rem;
    }

    .sidebar__link {
        padding: 0.8rem 1rem;
        border-left: 3px solid transparent;
        transition: all 0.3s ease;
    }

    .sidebar__link:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }

    .sidebar__link.active {
        border-left: 3px solid var(--buttons);
        background-color: rgba(63, 81, 181, 0.1);
        color: var(--buttons);
    }

    /* Cabecera con botón de modo oscuro */
    .menu-container .light-label {
        align-self: flex-end;
        margin: 0.5rem;
    }

    /* Contenido principal */
    .content {
        grid-area: content;
        padding: 2rem;
        overflow-y: auto;
    }

    .main-content {
        margin-top: 5rem;
    }

    /* Cabecera de inicio */
    .inicio-header {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0 1.5rem;
    }

    /* Tarjetas */
    .card-container {
        grid-template-columns: repeat(3, 1fr);
        max-width: 1200px;
        gap: 1.5rem;
    }

    .card {
        max-width: none;
        padding: 1.5rem;
    }

    /* Gráfico de ventas */
    .weekly-sales {
        max-width: 1200px;
        padding: 1.5rem;
    }
}

/* Mejoras adicionales para pantallas muy grandes */
@media (min-width: 1400px) {
    .menu-container {
        width: 280px;
    }
    
    .content {
        padding: 3rem;
    }
    
    .card-container {
        gap: 2rem;
    }
}

/* ===========================
    SECCIÓN PRODUCTOS
   =========================== */

/* Cabecera de sección */
.section-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1.5rem 0;
    padding: 0 1rem;
}

.section-title {
    font-family: 'Montserrat', sans-serif;
    color: var(--main-text);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Contenedor de búsqueda */
.search-container {
    display: flex;
    width: 100%;
    max-width: 500px;
    margin-bottom: 1.5rem;
    background-color: var(--sidebar-header);
    border-radius: 2rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.search-input {
    flex-grow: 1;
    padding: 0.8rem 1.2rem;
    border: none;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    background-color: transparent;
    color: var(--main-text);
}

.search-input:focus {
    outline: none;
}

.search-button {
    padding: 0 1.2rem;
    background-color: transparent;
    border: none;
    cursor: pointer;
    color: var(--buttons);
    transition: color 0.3s ease;
}

.search-button:hover {
    color: var(--hover);
}

/* Contenedor de tabla */
.table-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    overflow-x: auto;
}

.products-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--sidebar-header);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.products-table th,
.products-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.products-table th {
    background-color: rgba(0, 0, 0, 0.03);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    color: var(--secondary-text);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.products-table tbody tr {
    transition: background-color 0.3s ease;
}

.products-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.product-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 0.25rem;
    background-color: #f0f0f0;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.btn-edit, .btn-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit {
    background-color: var(--warn);
    color: white;
}

.btn-delete {
    background-color: var(--error);
    color: white;
}

.btn-edit:hover {
    background-color: #d8c52d;
    transform: scale(1.1);
}

.btn-delete:hover {
    background-color: #c21a1a;
    transform: scale(1.1);
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 1rem;
}

.pagination-button {
    padding: 0.6rem 1.5rem;
    background-color: var(--buttons);
    color: white;
    border: none;
    border-radius: 0.25rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.pagination-button:hover {
    background-color: var(--hover);
}

.page-number {
    font-family: 'Poppins', sans-serif;
    color: var(--secondary-text);
    font-size: 0.9rem;
}

/* ===========================
    RESPONSIVE PARA PRODUCTOS
   =========================== */
@media (max-width: 768px) {
    .products-table {
        min-width: 700px;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-container {
        width: 100%;
    }
}

/* ===========================
    MEJORAS PARA DESKTOP EN SECCIÓN PRODUCTOS
   =========================== */
@media (min-width: 1024px) {
    .section-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        max-width: 1200px;
        margin: 2rem auto;
    }
    
    .section-title {
        margin-bottom: 0;
    }
    
    .search-container {
        margin-bottom: 0;
        width: 50%;
    }
    
    .products-table th,
    .products-table td {
        padding: 1.2rem;
    }
    
    .image-column {
        width: 80px;
    }
    
    .actions-column {
        width: 120px;
    }
}

/* ===========================
   SECCIÓN PEDIDOS
   =========================== */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 500px;
}

.filter-select, .date-filter {
    flex: 1;
    padding: 0.8rem 1.2rem;
    border: none;
    border-radius: 0.25rem;
    background-color: var(--sidebar-header);
    font-family: 'Poppins', sans-serif;
    color: var(--main-text);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--sidebar-header);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.orders-table th,
.orders-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.orders-table th {
    background-color: rgba(0, 0, 0, 0.03);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    color: var(--secondary-text);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status {
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
}

.status-preparing {
    background-color: rgba(240, 224, 54, 0.2);
    color: #b0a220;
}

.status-shipped {
    background-color: rgba(63, 81, 181, 0.2);
    color: var(--buttons);
}

.status-delivered {
    background-color: rgba(48, 208, 98, 0.2);
    color: #1e8a46;
}

/* ===========================
   SECCIÓN CLIENTES
   =========================== */
.add-client-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background-color: var(--buttons);
    color: white;
    border: none;
    border-radius: 0.25rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.add-client-button:hover {
    background-color: var(--hover);
}

.clients-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--sidebar-header);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.clients-table th,
.clients-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.clients-table th {
    background-color: rgba(0, 0, 0, 0.03);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    color: var(--secondary-text);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===========================
   SECCIÓN CONFIGURACIÓN
   =========================== */
.settings-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.settings-card {
    background-color: var(--sidebar-header);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.settings-header h3 {
    font-family: 'Montserrat', sans-serif;
    color: var(--main-text);
    font-size: 1.3rem;
}

.settings-header .material-symbols-outlined {
    font-size: 2rem;
    color: var(--buttons);
}

.settings-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.settings-option:last-child {
    border-bottom: none;
}

.option-info {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.option-info .material-symbols-outlined {
    font-size: 1.5rem;
    color: var(--buttons);
}

.option-info h4 {
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 0.3rem;
    color: var(--main-text);
}

.option-info p {
    font-family: 'Poppins', sans-serif;
    color: var(--secondary-text);
    font-size: 0.85rem;
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--buttons);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Select de idioma */
.language-select {
    padding: 0.8rem;
    border-radius: 0.25rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background-color: var(--main-background);
    color: var(--main-text);
    font-family: 'Poppins', sans-serif;
    min-width: 150px;
}

/* ===========================
   MEDIA QUERIES PARA NUEVAS SECCIONES
   =========================== */
@media (max-width: 768px) {
    .orders-table, .clients-table {
        min-width: 700px;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .settings-option {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .switch, .language-select {
        align-self: flex-end;
    }
}

@media (min-width: 1024px) {
    .section-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        max-width: 1200px;
        margin: 2rem auto;
    }
    
    .section-title {
        margin-bottom: 0;
    }
    
    .filters {
        margin-bottom: 0;
        width: auto;
        max-width: none;
    }
    
    .settings-container {
        grid-template-columns: repeat(3, 1fr);
    }
}