/* Estilos específicos para el panel de administración */

/* Variables adicionales para admin */
:root {
    --admin-bg: #f8f9fa;
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
    --sidebar-hover: #34495e;
    --primary: #3498db;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #1abc9c;
}

/* Layout del admin */
.admin-container {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s;
    z-index: 1000;
}

.admin-main {
    flex: 1;
    margin-left: 250px;
    background-color: var(--admin-bg);
    min-height: 100vh;
}

/* Logo del admin */
.admin-logo {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-logo i {
    font-size: 2.5rem;
    color: var(--rosa);
    margin-bottom: 10px;
}

.admin-logo h2 {
    font-size: 1.3rem;
    margin-bottom: 5px;
    color: var(--sidebar-text);
}

.admin-logo p {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Navegación del admin */
.admin-nav ul {
    list-style: none;
    padding: 20px 0;
}

.admin-nav li {
    margin-bottom: 5px;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.3s;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
}

.admin-nav a:hover {
    background-color: var(--sidebar-hover);
    border-left-color: var(--rosa);
}

.admin-nav a.active {
    background-color: var(--sidebar-hover);
    border-left-color: var(--rosa);
    font-weight: 500;
}

.admin-nav a i {
    width: 20px;
    text-align: center;
}

/* Header del admin */
.admin-header {
    background-color: var(--blanco);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px var(--sombra);
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header h1 {
    font-size: 1.2rem;
    color: var(--gris-oscuro);
    margin: 0;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: var(--gris-claro);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
}

.admin-user i {
    font-size: 1.2rem;
    color: var(--gris);
}

/* Contenido del admin */
.admin-content {
    padding: 20px;
}

/* Tarjetas de estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: var(--blanco);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 5px var(--sombra);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background-color: var(--rosa);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon i {
    font-size: 1.3rem;
    color: var(--gris-oscuro);
}

.stat-info h3 {
    font-size: 1.4rem;
    margin-bottom: 3px;
    color: var(--gris-oscuro);
}

.stat-info p {
    color: var(--gris);
    font-size: 0.85rem;
}

/* Acciones rápidas */
.quick-actions {
    margin-bottom: 20px;
}

.quick-actions h2 {
    margin-bottom: 15px;
    color: var(--gris-oscuro);
    font-size: 1.2rem;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.action-card {
    background-color: var(--blanco);
    border-radius: 8px;
    padding: 20px;
    text-decoration: none;
    color: var(--gris-oscuro);
    text-align: center;
    box-shadow: 0 2px 5px var(--sombra);
    transition: all 0.3s;
    border: 1px solid transparent;
}

.action-card:hover {
    transform: translateY(-3px);
    border-color: var(--rosa);
    box-shadow: 0 4px 10px var(--sombra);
}

.action-card i {
    font-size: 2rem;
    color: var(--rosa);
    margin-bottom: 10px;
}

.action-card h4 {
    margin-bottom: 8px;
    font-size: 1rem;
}

.action-card p {
    color: var(--gris);
    font-size: 0.8rem;
}

/* Tablas */
.table-container {
    background-color: var(--blanco);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px var(--sombra);
    margin-bottom: 20px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

table thead {
    background-color: var(--gris-claro);
}

table th {
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    color: var(--gris-oscuro);
    border-bottom: 2px solid #eee;
    font-size: 0.9rem;
}

table td {
    padding: 12px 10px;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
}

table tbody tr:hover {
    background-color: #f9f9f9;
}

.empty-table {
    text-align: center;
    padding: 30px;
    color: var(--gris);
}

/* Badges de estado */
.stock-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.stock-badge.ok {
    background-color: #d4edda;
    color: #155724;
}

.stock-badge.low {
    background-color: #fff3cd;
    color: #856404;
}

.stock-badge.out {
    background-color: #f8d7da;
    color: #721c24;
}

/* Botones de acción en tablas */
.actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-edit,
.btn-delete {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.btn-edit {
    background-color: #e3f2fd;
    color: #1976d2;
}

.btn-edit:hover {
    background-color: #bbdefb;
}

.btn-delete {
    background-color: #ffebee;
    color: #d32f2f;
}

.btn-delete:hover {
    background-color: #ffcdd2;
}

/* Formularios */
.product-form {
    background-color: var(--blanco);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--sombra);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gris-oscuro);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Alertas */
.alert {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    border-left: 4px solid transparent;
    font-size: 0.9rem;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Tabs */
.admin-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.tab-btn {
    padding: 8px 15px;
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    color: var(--gris);
    transition: all 0.3s;
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab-btn.active {
    background-color: var(--rosa);
    color: var(--gris-oscuro);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Miniaturas de productos */
.product-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
}

/* ========== MEJORAS PARA PEDIDOS ========== */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-block;
    min-width: 70px;
    text-align: center;
    white-space: nowrap;
}

.status-pendiente {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-procesando {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.status-completado {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-cancelado {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Botones de acción responsivos */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: auto;
}

.action-btn {
    padding: 5px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 3px;
    transition: all 0.3s;
    text-align: left;
    width: 100%;
}

.btn-completar {
    background-color: #48bb78;
    color: white;
}

.btn-completar:hover {
    background-color: #38a169;
}

.btn-cancelar {
    background-color: #f56565;
    color: white;
}

.btn-cancelar:hover {
    background-color: #e53e3e;
}

.btn-procesando {
    background-color: #4299e1;
    color: white;
}

.btn-procesando:hover {
    background-color: #3182ce;
}

.btn-eliminar {
    background-color: #a0aec0;
    color: white;
}

.btn-eliminar:hover {
    background-color: #718096;
}

.btn-whatsapp {
    background-color: #25D366;
    color: white;
}

.btn-whatsapp:hover {
    background-color: #1da851;
}

.pedido-detalle-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.detalle-content {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
    margin-top: 20px;
}

.detalle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.detalle-header h3 {
    color: var(--gris-oscuro);
    margin: 0;
    font-size: 1.1rem;
}

.close-detalle {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--gris);
}

.detalle-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.detalle-cliente,
.detalle-productos,
.detalle-totales {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
}

.detalle-cliente h4,
.detalle-productos h4,
.detalle-totales h4 {
    margin-bottom: 10px;
    color: var(--gris-oscuro);
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    font-size: 0.95rem;
}

.producto-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
}

.producto-item:last-child {
    border-bottom: none;
}

.producto-info {
    flex: 1;
}

.producto-cantidad {
    font-weight: bold;
    color: var(--rosa-oscuro);
    margin-right: 5px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 5px 0;
    font-size: 0.9rem;
}

.total-final {
    font-weight: bold;
    font-size: 1rem;
    color: var(--gris-oscuro);
    border-top: 2px solid #ddd;
    padding-top: 10px;
    margin-top: 5px;
}

.detalle-acciones {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.filtros-pedidos {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    overflow-x: auto;
    padding-bottom: 5px;
}

.filtro-btn {
    padding: 6px 12px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.filtro-btn.active {
    background-color: var(--rosa);
    border-color: var(--rosa);
}

.filtro-btn:hover:not(.active) {
    background-color: #e9ecef;
}

/* Efectos hover para filas de pedidos */
.pedido-row:hover {
    background-color: #f9f9f9;
    transition: background-color 0.3s;
}

/* Animaciones para cambios de estado */
@keyframes highlightChange {
    0% {
        background-color: transparent;
    }

    50% {
        background-color: #fff9db;
    }

    100% {
        background-color: transparent;
    }
}

.pedido-row.changed {
    animation: highlightChange 2s ease;
}

/* Estilos para el modal de confirmación */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    padding: 15px;
    box-sizing: border-box;
}

.confirm-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 100%;
    width: 100%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.confirm-content h4 {
    margin-bottom: 10px;
    color: var(--gris-oscuro);
    font-size: 1.1rem;
}

.confirm-content p {
    margin-bottom: 15px;
    color: var(--gris);
    font-size: 0.9rem;
}

.confirm-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.confirm-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    min-width: 80px;
    font-size: 0.9rem;
}

.confirm-btn.cancel {
    background-color: #f8f9fa;
    color: var(--gris);
    border: 1px solid #ddd;
}

.confirm-btn.confirm {
    background-color: var(--danger);
    color: white;
}

.confirm-btn.confirm.success {
    background-color: var(--success);
}

.confirm-btn.confirm.warning {
    background-color: var(--warning);
}

.confirm-btn.confirm.info {
    background-color: var(--info);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1100;
    background-color: var(--rosa);
    color: var(--gris-oscuro);
    border: none;
    border-radius: 5px;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.mobile-menu-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1101;
}

/* ========== RESPONSIVE ========== */

/* Tablets (768px - 992px) */
@media (max-width: 992px) {
    .admin-sidebar {
        width: 200px;
    }

    .admin-main {
        margin-left: 200px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .action-buttons {
        min-width: 100px;
    }

    .action-btn {
        font-size: 0.7rem;
        padding: 4px 6px;
    }

    table {
        min-width: 700px;
    }
}

/* Mobile (menos de 768px) */
@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }

    .admin-sidebar {
        position: fixed;
        width: 100%;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 1000;
    }

    .admin-sidebar.active {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
        margin-top: 0;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .mobile-menu-close {
        display: block;
    }

    .admin-header {
        padding: 10px 15px;
        flex-direction: row;
        justify-content: space-between;
    }

    .admin-header h1 {
        font-size: 1rem;
        margin-left: 50px;
    }

    .admin-user {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    .admin-user i {
        font-size: 1rem;
    }

    .admin-content {
        padding: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-icon {
        width: 45px;
        height: 45px;
    }

    .stat-icon i {
        font-size: 1.2rem;
    }

    .stat-info h3 {
        font-size: 1.2rem;
    }

    .actions-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .action-card {
        padding: 15px;
    }

    .action-card i {
        font-size: 1.8rem;
    }

    .table-container {
        margin: 0 -15px;
        border-radius: 0;
        box-shadow: none;
    }

    table {
        min-width: 800px;
    }

    table th,
    table td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .product-form {
        padding: 15px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions button {
        width: 100%;
    }

    .detalle-content {
        padding: 15px;
        max-height: 95vh;
        margin-top: 10px;
    }

    .detalle-acciones {
        flex-direction: column;
    }

    .detalle-acciones .action-btn {
        width: 100%;
        justify-content: center;
    }

    .action-buttons {
        flex-direction: column;
        gap: 3px;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
        padding: 6px;
        font-size: 0.75rem;
    }

    .filtros-pedidos {
        margin: 0 -15px 15px;
        padding: 0 15px 5px;
    }

    .filter-buttons {
        margin: 0 -15px 15px;
        padding: 0 15px;
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .filter-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* Mobile pequeño (menos de 480px) */
@media (max-width: 480px) {
    .admin-header h1 {
        font-size: 0.9rem;
        max-width: 150px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .admin-user {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .admin-user i {
        font-size: 0.9rem;
    }

    .admin-logo {
        padding: 15px;
    }

    .admin-logo i {
        font-size: 1.5rem;
    }

    .admin-logo h2 {
        font-size: 1rem;
    }

    .admin-logo p {
        font-size: 0.7rem;
    }

    .admin-nav a {
        padding: 10px 15px;
        font-size: 0.85rem;
    }

    .status-badge {
        min-width: 60px;
        font-size: 0.65rem;
        padding: 3px 6px;
    }

    .stock-badge {
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    .btn-edit,
    .btn-delete {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }

    .tab-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .product-thumb {
        width: 35px;
        height: 35px;
    }

    .stock-input {
        width: 70px;
        padding: 6px;
    }

    .stock-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

/* Landscape móviles */
@media (max-height: 600px) and (orientation: landscape) {
    .admin-sidebar {
        overflow-y: auto;
    }

    .admin-logo {
        padding: 15px;
    }

    .admin-logo i {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }

    .admin-nav ul {
        padding: 10px 0;
    }

    .admin-nav a {
        padding: 8px 15px;
        font-size: 0.85rem;
    }

    .detalle-content {
        max-height: 85vh;
        margin-top: 5px;
    }
}

/* Impresión */
@media print {

    .admin-sidebar,
    .mobile-menu-toggle,
    .admin-header,
    .actions,
    .form-actions,
    .action-buttons {
        display: none !important;
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-content {
        padding: 0;
    }

    .table-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    table {
        min-width: auto;
    }
}