/* Reset básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

/* Variables de color para modo claro y oscuro */
:root {
    --primary-color: #72B42C;
    --secondary-color: #818385;
    --dark-color: #000000;
    --light-color: #f8f9fa;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --card-bg: #ffffff;
    --text-color: #000000;
    --bg-color: #f5f5f5;
    --header-bg: #000000;
    --header-text: #ffffff;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --table-header-bg: #000000;
    --table-header-text: #ffffff;
    --table-stripe: rgba(114, 180, 44, 0.05);
    --table-hover: rgba(114, 180, 44, 0.1);
    --modal-bg: #ffffff;
    --modal-text: #000000;
    --input-bg: #ffffff;
    --input-text: #000000;
    --input-border: #818385;
}

[data-theme="dark"] {
    --primary-color: #8bc34a;
    --secondary-color: #9e9e9e;
    --dark-color: #ffffff;
    --light-color: #2d2d2d;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --bg-color: #121212;
    --header-bg: #000000;
    --header-text: #72B42C;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    --table-header-bg: #000000;
    --table-header-text: #72B42C;
    --table-stripe: rgba(139, 195, 74, 0.05);
    --table-hover: rgba(139, 195, 74, 0.1);
    --modal-bg: #1e1e1e;
    --modal-text: #e0e0e0;
    --input-bg: #2d2d2d;
    --input-text: #e0e0e0;
    --input-border: #9e9e9e;
}

/* Estilos generales */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Tipografía */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--dark-color);
    font-family: 'Montserrat', sans-serif;
}

h1 {
    font-size: 2.5rem;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    font-weight: 700;
}

h5 {
    color: var(--header-text);
}

h2 {
    font-size: 1.8rem;
    color: var(--dark-color);
    font-weight: 600;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid var(--secondary-color);
    margin-bottom: 20px;
    overflow: hidden;
    transition: background-color 0.3s, border-color 0.3s;
}

.card-header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 15px 20px;
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color);
    transition: background-color 0.3s, color 0.3s;
}

.card-body {
    padding: 20px;
}

.table-responsive{
    overflow-x: auto;
}

/* Formularios */
.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
    transition: color 0.3s;
}

.form-control, .form-select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    font-size: 1rem;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
    background-color: var(--input-bg);
    color: var(--input-text);
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(114, 180, 44, 0.2);
}

/* Botones */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: 'Montserrat', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--dark-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: var(--dark-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-warning {
    background-color: var(--warning-color);
    color: var(--dark-color);
}

.btn-warning:hover {
    background-color: var(--dark-color);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--dark-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-info {
    background-color: var(--primary-color);
    color: #ffffff;
}

.btn-info:hover {
    background-color: var(--dark-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-action {
    margin: 0 3px;
}

/* Tablas */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-family: 'Montserrat', sans-serif;
}

.table th, .table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--secondary-color);
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.table th {
    background-color: var(--table-header-bg);
    color: var(--table-header-text);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--table-stripe);
}

.table-hover tbody tr:hover {
    background-color: var(--table-hover);
}

/* Operaciones */
.operacion-ingreso {
    background-color: rgba(114, 180, 44, 0.1) !important;
}

.operacion-salida {
    background-color: rgba(129, 131, 133, 0.1) !important;
}

/* Grid system */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col-md-1, .col-md-2, .col-md-3, .col-md-4, 
.col-md-5, .col-md-6, .col-md-7, .col-md-8, 
.col-md-9, .col-md-10, .col-md-11, .col-md-12 {
    padding: 0 15px;
    margin-bottom: 15px;
}

.col-md-1 { width: 8.33%; }
.col-md-2 { width: 16.66%; }
.col-md-3 { width: 25%; }
.col-md-4 { width: 33.33%; }
.col-md-5 { width: 41.66%; }
.col-md-6 { width: 50%; }
.col-md-7 { width: 58.33%; }
.col-md-8 { width: 66.66%; }
.col-md-9 { width: 75%; }
.col-md-10 { width: 83.33%; }
.col-md-11 { width: 91.66%; }
.col-md-12 { width: 100%; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    overflow-y: auto;
}

.modal-dialog {
    max-width: 800px;
    margin: 30px auto;
}

.modal-content {
    background-color: var(--modal-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid var(--secondary-color);
    transition: background-color 0.3s, border-color 0.3s;
}

.modal-header {
    padding: 15px 20px;
    background-color: var(--header-bg);
    color: var(--header-text);
    border-bottom: 2px solid var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s, color 0.3s;
}

.modal-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--header-text);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--secondary-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--header-text);
    transition: color 0.3s;
}

/* Alertas */
.alert {
    padding: 10px 15px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    font-family: 'Montserrat', sans-serif;
}

.alert-danger {
    margin-top: 20px;
    background-color: #ff0000;
    border: 2px solid rgba(0, 0, 0, 0.36);
    box-shadow: 0px 0px 10px 1px #ff0000;
    color: #ffffff;
    text-align: center;
}

.d-none {
    display: none;
}

/* Utilidades */
.text-center {
    text-align: center;
}

.my-4 {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.w-100 {
    width: 100%;
}

.d-flex {
    display: flex;
}

.align-items-end {
    align-items: flex-end;
}

.justify-content-start {
    justify-content: flex-start;
}

.justify-content-center {
    justify-content: center;
}

.me-2 {
    margin-right: 0.5rem;
}

/* Login */
.min-vh-100 {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

/* Interruptor de tema */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    margin-left: 15px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--secondary-color);
    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(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.theme-toggle-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 15px;
}

.theme-label {
    margin-right: 10px;
    font-weight: 500;
    color: var(--text-color);
    transition: color 0.3s;
}

/* Responsividad */
@media (max-width: 768px) {
    .col-md-1, .col-md-2, .col-md-3, .col-md-4, 
    .col-md-5, .col-md-6, .col-md-7, .col-md-8, 
    .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
        width: 100%;
    }
    
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .table-responsive {
        overflow-x: auto;
        display: block;
        width: 100%;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .d-flex.justify-content-start {
        flex-direction: column;
        gap: 10px;
    }
    
    .me-2 {
        margin-right: 0;
    }
    
    .theme-toggle-container {
        justify-content: center;
        margin-top: 15px;
    }
}

/* Ajustes específicos para tablas */
td {
    white-space: nowrap;
}

#resultadosBusqueda tr td:last-child {
    white-space: nowrap;
}

/* Mejoras visuales adicionales */
.card-header h2 {
    margin: 0;
    color: var(--header-text);
}

.w-auto {
    width: auto;
}

.px-5 {
    padding-left: 3rem;
    padding-right: 3rem;
}