/* ===== RESET Y CONFIGURACIÓN BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #009966;
    --secondary-color: #258667;
    --dark-bg: #ffffff;
    --light-bg: #f8f9fa;
    --sidebar-bg: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #6c757d;
    --success: #009966;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --border-color: #e0e0e0;
    --hover-bg: #f5f5f5;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
    color: var(--text-primary);
    line-height: 1.6;
}

/* ===== LOGIN PAGE ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #f0f4f8 0%, #ffffff 100%);
    padding: 20px;
}

.login-box {
    background: #ffffff;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 153, 102, 0.15);
    width: 100%;
    max-width: 450px;
    border: 1px solid var(--border-color);
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.logo p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 153, 102, 0.1);
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-container input {
    margin-right: 8px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 153, 102, 0.3);
}

.login-footer {
    text-align: center;
    margin-top: 30px;
}

.login-footer p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ===== ADMIN LAYOUT ===== */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 260px;
    background: #ffffff;
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    border-right: 2px solid var(--border-color);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.sidebar-header h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    margin: 5px 15px;
    border-radius: 8px;
}

.nav-item:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    border-left-color: var(--primary-color);
}

.nav-item.active {
    background: rgba(0, 153, 102, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.nav-item .icon {
    font-size: 1.3rem;
    margin-right: 12px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 30px;
    background: #f8f9fa;
    min-height: 100vh;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.content-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

/* ===== STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 153, 102, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.stat-change {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-change.positive {
    color: var(--success);
}

.stat-card-small {
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
}

.stat-card-small:hover {
    box-shadow: 0 4px 12px rgba(0, 153, 102, 0.1);
}

.stat-card-small h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.stat-card-small .stat-number {
    font-size: 1.8rem;
}

/* ===== CHARTS ===== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chart-card h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-weight: 600;
}

.chart-placeholder {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    color: var(--text-secondary);
    border: 2px dashed var(--border-color);
}

/* ===== TABLES ===== */
.table-container {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.recent-activity {
    margin-top: 30px;
}

.recent-activity h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f8f9fa;
}

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.data-table tbody tr:hover {
    background: rgba(0, 153, 102, 0.05);
    transition: background 0.3s;
}

/* ===== BADGES ===== */
.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
}

.badge-success {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success);
}

.badge-info {
    background: rgba(33, 150, 243, 0.2);
    color: var(--info);
}

.badge-warning {
    background: rgba(255, 152, 0, 0.2);
    color: var(--warning);
}

.badge-danger {
    background: rgba(244, 67, 54, 0.2);
    color: var(--danger);
}

/* ===== FILTERS SECTION ===== */
.filters-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 15px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 250px;
}

.search-box input {
    flex: 1;
    padding: 12px 15px;
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 153, 102, 0.1);
}

.btn-search {
    padding: 12px 20px;
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    color: #ffffff;
    transition: all 0.3s;
}

.btn-search:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 12px 15px;
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-secondary {
    padding: 12px 20px;
    background: #ffffff;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-secondary:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

.btn-action {
    padding: 8px 12px;
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    margin-right: 5px;
    transition: all 0.3s;
}

.btn-action:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.btn-page {
    padding: 10px 15px;
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s;
}

.btn-page:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

.btn-page.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

/* ===== PRODUCT SPECIFIC ===== */
.product-img {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 1.5rem;
    border: 2px solid var(--border-color);
}

.top-products {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.product-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-name {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #f8f9fa;
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    padding-left: 15px;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    transition: width 0.5s ease;
}

/* ===== MODAL DE COMPRAS ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    position: relative;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background: var(--hover-bg);
    color: var(--danger);
    transform: rotate(90deg);
}

.purchases-list {
    list-style: none;
    padding: 0;
}

.purchase-item {
    padding: 15px;
    margin-bottom: 10px;
    background: var(--light-bg);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.purchase-item:hover {
    background: #e8f5e9;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 153, 102, 0.1);
}

.purchase-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.product-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.product-quantity {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.product-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 5px;
}

.no-purchases {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.purchases-summary {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    color: var(--primary-color);
}

.btn-view-purchases {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.btn-view-purchases:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 153, 102, 0.2);
}

.purchases-preview {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.purchases-cell {
    max-width: 300px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }
    
    .main-content {
        margin-left: 80px;
    }
    
    .sidebar-header h2,
    .nav-item span:not(.icon) {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-section {
        flex-direction: column;
    }
}
