/* Variables CSS */
:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --secondary-color: #2196F3;
    --danger-color: #f44336;
    --text-color: #333;
    --text-light: #666;
    --border-color: #ddd;
    --bg-light: #f5f5f5;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.15);
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 2rem;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    opacity: 0.9;
    font-size: 1rem;
}

/* Pestañas */
.tabs {
    display: flex;
    background: var(--bg-light);
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    flex: 1;
    min-width: 100px;
    padding: 1rem;
    background: none;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.tab-btn:hover {
    background: rgba(76, 175, 80, 0.1);
}

.tab-btn.active {
    color: var(--primary-color);
    background: white;
    border-bottom: 3px solid var(--primary-color);
}

/* Contenido de pestañas */
.tab-content {
    display: none;
    padding: 1.5rem;
}

.tab-content.active {
    display: block;
}

/* Tarjetas */
.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.card h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

/* Formularios */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

textarea {
    resize: vertical;
}

/* Botones */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    margin: 0.5rem 0;
}

.btn-secondary:hover {
    background: #1976D2;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    margin: 0.5rem 0;
}

.btn-danger:hover {
    background: #d32f2f;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Listas de items */
.lista-items {
    max-height: 500px;
    overflow-y: auto;
}

.item {
    background: var(--bg-light);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: all 0.3s;
}

.item:hover {
    box-shadow: var(--shadow);
    transform: translateX(4px);
}

.item-info {
    flex: 1;
}

.item-title {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.item-details {
    font-size: 0.9rem;
    color: var(--text-light);
}

.item-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-delete {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.btn-delete:hover {
    background: #d32f2f;
}

.btn-edit {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    margin-right: 0.5rem;
}

.btn-edit:hover {
    background: #1976D2;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Barra de búsqueda */
.search-bar {
    margin-bottom: 1rem;
}

.search-bar input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

/* Mensajes vacíos */
.empty-message {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
    font-style: italic;
}

/* Estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Top items */
.top-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.top-item-name {
    font-weight: 600;
}

.top-item-value {
    color: var(--primary-color);
    font-weight: 700;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-light);
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .tab-btn {
        font-size: 0.85rem;
        padding: 0.75rem 0.5rem;
        min-width: 80px;
    }

    .tab-content {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .item {
        flex-direction: column;
    }

    .item-actions {
        margin-top: 0.5rem;
        width: 100%;
        flex-direction: column;
    }

    .btn-delete,
    .btn-edit {
        width: 100%;
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    .tabs {
        font-size: 0.8rem;
    }

    .stats-grid {
        gap: 0.5rem;
    }

    .stat-card {
        padding: 1rem;
    }
}

/* Desktop adjustments */
@media (min-width: 769px) {
    #card-total-ventas {
        grid-column: span 2;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.item {
    animation: fadeIn 0.3s ease-out;
}

/* Scrollbar personalizada */
.lista-items::-webkit-scrollbar {
    width: 8px;
}

.lista-items::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

.lista-items::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.lista-items::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}
