* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, 
#667eea 0%, 
#764ba2 100%);
    min-height: 100vh;
    line-height: 1.6;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    color: white;
    font-size: 1.8em;
    font-weight: 700;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    color: white;
    font-weight: 600;
    margin-right: 1rem;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
#667eea 0%, 
#764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Login Required */
.login-required {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
#667eea 0%, 
#764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9998;
}

.login-card {
    background: white;
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.login-card h2 {
    color: 
#495057;
    margin-bottom: 1rem;
}

.login-card p {
    color: 
#6c757d;
    margin-bottom: 2rem;
}

.login-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.app-header {
    background: linear-gradient(135deg, 
#4CAF50, 
#45a049);
    color: white;
    padding: 30px;
    text-align: center;
}

.app-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* Tabs */
.tabs {
    display: flex;
    background: 
#f8f9fa;
    border-bottom: 1px solid 
#dee2e6;
}

.tab {
    flex: 1;
    padding: 15px 20px;
    background: 
#e9ecef;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab.active {
    background: white;
    border-bottom-color: 
#4CAF50;
    color: 
#4CAF50;
}

.tab:hover {
    background: 
#f8f9fa;
}

.tab-content {
    display: none;
    padding: 30px;
}

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

/* Controls */
.controls {
    padding: 20px 30px;
    background: 
#f8f9fa;
    border-bottom: 1px solid 
#e9ecef;
}

.month-selector {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.month-selector label {
    font-weight: 600;
    color: 
#495057;
}

.month-selector select, .month-selector input {
    padding: 10px 15px;
    border: 2px solid 
#dee2e6;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.month-selector select:focus, .month-selector input:focus {
    outline: none;
    border-color: 
#4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Buttons */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, 
#4CAF50, 
#45a049);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, 
#6c757d, 
#5a6268);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, 
#dc3545, 
#c82333);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, 
#ffc107, 
#e0a800);
    color: #000;
}

/* Tables */
.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.excel-table th {
    background: linear-gradient(135deg, 
#495057, 
#343a40);
    color: white;
    padding: 15px 12px;
    text-align: center;
    font-weight: 600;
    border: 1px solid 
#dee2e6;
}

.excel-table td {
    padding: 12px;
    border: 1px solid 
#dee2e6;
    text-align: center;
    transition: background-color 0.2s ease;
}

.excel-table td:hover {
    background-color: 
#f8f9fa;
}

.excel-table input, .excel-table select, .excel-table textarea {
    width: 100%;
    border: none;
    padding: 8px;
    text-align: center;
    background: transparent;
    font-size: 14px;
}

.excel-table input:focus {
    outline: 2px solid 
#4CAF50;
    background: white;
    border-radius: 4px;
}

/* Forms */
.add-expense-form {
    background: 
#f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: 
#495057;
}

.form-group input, .form-group select, .form-group textarea {
    padding: 10px;
    border: 2px solid 
#dee2e6;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: 
#4CAF50;
}

.form-group textarea {
    min-height: 60px;
    resize: vertical;
}

/* Alerts */
.alert {
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    border-left: 5px solid;
}

.alert-warning {
    background-color: 
#fff3cd;
    border-color: 
#ffc107;
    color: 
#856404;
}

.alert-danger {
    background-color: 
#f8d7da;
    border-color: 
#dc3545;
    color: 
#721c24;
}

/* Summary Cards */
.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.summary-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    text-align: center;
    border-left: 5px solid 
#4CAF50;
    transition: transform 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-5px);
}

.summary-card h3 {
    color: 
#495057;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.summary-card .amount {
    font-size: 2em;
    font-weight: bold;
    color: 
#4CAF50;
}

/* Stock Status */
.stock-low {
    background-color: 
#ffe6e6 !important;
    color: 
#d63031;
    font-weight: bold;
}

.stock-medium {
    background-color: 
#fff2e6 !important;
    color: 
#e17055;
}

.stock-good {
    background-color: 
#e6ffe6 !important;
    color: 
#00b894;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        margin: 1rem;
        border-radius: 10px;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab {
        flex: 1 1 50%;
        min-width: 150px;
    }

    .month-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .month-selector > * {
        width: 100%;
    }

    .excel-table {
        font-size: 12px;
    }

    .excel-table th, .excel-table td {
        padding: 8px 6px;
    }
}

@media print {
    body { 
        background: white !important; 
        padding: 0 !important; 
    }
    .header { display: none !important; }
    .container { 
        box-shadow: none !important; 
        border-radius: 0 !important; 
        margin: 0 !important;
    }
    .controls, .tabs, .add-expense-form { 
        display: none !important; 
    }
    .excel-table { 
        font-size: 12px !important; 
    }
} 
/* Mejoras para tablas en móvil */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    /* Contenedor con scroll horizontal para tablas */
    .table-container {
        margin: 0 -15px;
        padding: 0 15px;
    }
    
    .excel-table {
        min-width: 800px; /* Ancho mínimo para que se vea bien */
        font-size: 13px;
    }
    
    .excel-table th, .excel-table td {
        padding: 10px 8px;
        white-space: nowrap;
    }
    
    /* Columnas específicas con anchos mínimos */
    .excel-table th:first-child,
    .excel-table td:first-child {
        min-width: 120px; /* Producto/Concepto */
        position: sticky;
        left: 0;
        background: white;
        z-index: 1;
    }
    
    .excel-table th:first-child {
        background: linear-gradient(135deg, #495057, #343a40);
    }
    
    /* Ajustar botones en móvil */
    .excel-table .btn {
        padding: 6px 12px;
        font-size: 11px;
        margin: 2px;
    }
    
    /* Inputs más pequeños en tablas móviles */
    .excel-table input[type="number"] {
        width: 80px;
        font-size: 12px;
    }
    
    /* Indicador de scroll */
    .table-container::after {
        content: "← Desliza para ver más →";
        display: block;
        text-align: center;
        padding: 10px;
        background: #f8f9fa;
        color: #6c757d;
        font-size: 12px;
        font-style: italic;
        border-top: 1px solid #dee2e6;
    }
}

@media (max-width: 480px) {
    /* Para pantallas muy pequeñas */
    .excel-table {
        min-width: 900px; /* Aún más ancho para que sea usable */
        font-size: 12px;
    }
    
    .excel-table th, .excel-table td {
        padding: 8px 6px;
    }
    
    /* Hacer la primera columna más visible */
    .excel-table th:first-child,
    .excel-table td:first-child {
        min-width: 100px;
        font-weight: bold;
        box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    }
}

/* Mejoras para las acciones en móvil */
@media (max-width: 768px) {
    .user-actions {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    
    .user-actions .btn {
        width: 100%;
        padding: 4px 8px;
        font-size: 10px;
    }
}
