/* =====================================================
   CONTABILIDAD FERRISOLUCIONES - ESTILOS PRINCIPALES
   ===================================================== */

:root {
    --primary-color: #000000;
    --secondary-color: #fbc318;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #fbc318;
    --info-color: #16a085;
    --light-bg: #f8f9fa;
    --dark-bg: #1a1a1a;
    --text-dark: #000000;
    --text-light: #666666;
    --border-color: #dddddd;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
    --accent-yellow: #fbc318;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #fbc318 0%, #000000 100%);
    color: var(--text-dark);
    line-height: 1.6;
}

/* =====================================================
   LOGIN STYLES
   ===================================================== */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow-hover);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    animation: fadeInUp 0.5s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 180px;
    height: auto;
    margin-bottom: 20px;
}

.login-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.login-header h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.login-form input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: var(--accent-yellow);
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-login:hover {
    background: var(--accent-yellow);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.error-message {
    margin-top: 15px;
    padding: 12px;
    background: #ffe6e6;
    color: var(--danger-color);
    border-radius: 8px;
    border-left: 4px solid var(--danger-color);
}

/* =====================================================
   APP CONTAINER
   ===================================================== */

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
    background: var(--light-bg);
    overflow: hidden;
}

/* Header */
.app-header {
    background: white;
    padding: 15px 30px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.app-logo {
    width: 60px;
    height: auto;
}

.header-left i {
    font-size: 1.8rem;
    color: var(--primary-color);
}

.header-left h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
    font-weight: 500;
}

.user-info i {
    font-size: 1.5rem;
    color: var(--secondary-color);
}

.btn-logout {
    padding: 10px 20px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* Navigation */
.main-nav {
    background: white;
    padding: 0;
    box-shadow: var(--shadow);
    display: flex;
    overflow-x: auto;
}

.nav-item {
    flex: 1;
    min-width: 150px;
    padding: 18px 20px;
    background: white;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item:hover {
    background: var(--light-bg);
    color: var(--secondary-color);
}

.nav-item.active {
    color: var(--primary-color);
    border-bottom-color: var(--accent-yellow);
    background: #fffbf0;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

#moduleContainer {
    background: white;
    border-radius: 0;
    box-shadow: none;
    flex: 1;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.module-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    color: var(--text-light);
}

.module-placeholder i {
    color: var(--border-color);
    margin-bottom: 20px;
}

.module-placeholder h2 {
    color: var(--text-dark);
    margin-bottom: 10px;
}

/* Ocultar scrollbar en webkit browsers pero mantener funcionalidad */
.dashboard-body::-webkit-scrollbar {
    width: 8px;
}

.dashboard-body::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.dashboard-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--light-bg);
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Footer */
.app-footer {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
}

.app-footer p {
    margin: 5px 0;
    font-size: 0.9rem;
}

/* =====================================================
   DASHBOARD STYLES
   ===================================================== */

.dashboard-body {
    background: var(--light-bg);
    padding: 20px;
    min-height: 100vh;
    height: 100vh;
    box-sizing: border-box;
    margin: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

.dashboard-header {
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dashboard-logo {
    width: 70px;
    height: auto;
}

.header-title i {
    font-size: 2rem;
    color: var(--secondary-color);
}

.header-title h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
}

.header-date {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 1.1rem;
}

.btn-refresh {
    padding: 12px 24px;
    background: var(--accent-yellow);
    color: var(--primary-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    background: var(--primary-color);
    color: var(--accent-yellow);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Alertas */
.alerts-container {
    margin-bottom: 20px;
}

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideInDown 0.5s ease;
}

.alert i {
    font-size: 1.5rem;
}

.alert-info {
    background: #e3f2fd;
    color: #1976d2;
    border-left: 4px solid #1976d2;
}

.alert-warning {
    background: #fff3e0;
    color: #f57c00;
    border-left: 4px solid #f57c00;
}

.alert-success {
    background: #e8f5e9;
    color: #388e3c;
    border-left: 4px solid #388e3c;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 20px;
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.metric-icon {
    width: 70px;
    height: 70px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
}

.metric-card.ventas .metric-icon {
    background: linear-gradient(135deg, #fbc318 0%, #f39c12 100%);
}

.metric-card.ingresos .metric-icon {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

.metric-card.egresos .metric-icon {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.metric-card.caja-esperada .metric-icon {
    background: linear-gradient(135deg, #000000 0%, #fbc318 100%);
}

.metric-content {
    flex: 1;
}

.metric-content h3 {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.metric-detail {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.metric-detail strong {
    color: var(--text-dark);
}

.metric-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
}

.detail-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: fadeIn 0.6s ease;
}

.card-header {
    background: var(--primary-color);
    color: var(--accent-yellow);
    padding: 18px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    background: var(--accent-yellow);
    color: var(--primary-color);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

.card-body {
    padding: 20px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--light-bg);
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.no-data {
    text-align: center !important;
    color: var(--text-light) !important;
    font-style: italic;
    padding: 40px !important;
}

/* Conciliación */
.detail-card.conciliacion {
    grid-column: span 2;
}

.conciliacion-content {
    font-size: 1.05rem;
}

.conciliacion-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
}

.conciliacion-item.total {
    font-size: 1.3rem;
    border-top: 3px solid var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    margin-top: 10px;
    padding: 15px 0;
}

.conciliacion-item.alerta {
    background: #fff3cd;
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 10px;
    border: none;
}

.conciliacion-item .value {
    font-weight: bold;
    color: var(--primary-color);
}

.conciliacion-item .value.positive {
    color: var(--success-color);
}

.conciliacion-item .value.negative {
    color: var(--danger-color);
}

.conciliacion-item .value.warning {
    color: var(--warning-color);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.loading-spinner i {
    margin-bottom: 15px;
}

.loading-spinner p {
    font-size: 1.2rem;
}

.loading-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.loading-message i {
    font-size: 3rem;
    margin-bottom: 15px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =====================================================
   DASHBOARD CARDS - NUEVO DISEÑO
   ===================================================== */

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.dashboard-card {
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.card-main {
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 2px solid var(--light-bg);
}

.card-icon {
    width: 70px;
    height: 70px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    flex-shrink: 0;
}

.ventas-icon {
    background: linear-gradient(135deg, #fbc318 0%, #f39c12 100%);
}

.ingresos-icon {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

.egresos-icon {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.transferencias-icon {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.card-info {
    flex: 1;
}

.card-info h3 {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-light);
}

.card-expand-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--light-bg);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.card-expand-btn:hover {
    background: var(--accent-yellow);
    color: var(--primary-color);
    transform: scale(1.1);
}

.card-subcards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.subcard {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: white;
    border-right: 1px solid var(--light-bg);
    border-bottom: 1px solid var(--light-bg);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.subcard:last-child {
    border-right: none;
}

.subcard:hover {
    background: var(--light-bg);
}

.subcard-label {
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.subcard-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.subcard-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    color: var(--border-color);
    font-size: 0.9rem;
}

.warning-subcard {
    background: #fffbf0;
}

.warning-subcard:hover {
    background: #fff3cd;
}

.success-subcard {
    background: #f0fdf4;
}

.danger-subcard {
    background: #fef2f2;
}

/* Conciliación Card */
.conciliacion-card {
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 30px;
}

.conciliacion-header {
    background: linear-gradient(135deg, #000000 0%, #fbc318 100%);
    color: white;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.conciliacion-header i {
    font-size: 2rem;
}

.conciliacion-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.conciliacion-body {
    padding: 30px;
}

.conciliacion-row {
    display: flex;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid var(--light-bg);
    font-size: 1.1rem;
}

.concil-label {
    color: var(--text-dark);
}

.concil-value {
    font-weight: bold;
    color: var(--primary-color);
}

.conciliacion-row.positive .concil-value {
    color: var(--success-color);
}

.conciliacion-row.negative .concil-value {
    color: var(--danger-color);
}

.conciliacion-row.total {
    border-top: 3px solid var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    padding: 20px 0;
    margin-top: 15px;
    font-size: 1.4rem;
}

.conciliacion-row.total .total-value {
    color: var(--accent-yellow);
    background: var(--primary-color);
    padding: 8px 20px;
    border-radius: 8px;
}

.conciliacion-row.warning-row {
    background: #fff3cd;
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 15px;
    border: none;
}

.conciliacion-divider {
    height: 2px;
    background: var(--border-color);
    margin: 15px 0;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideInUp 0.3s ease;
    margin: auto;
}

.modal-header {
    background: var(--primary-color);
    color: var(--accent-yellow);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    flex: 1;
}

.modal-header-buttons {
    display: flex;
    gap: 10px;
}

.modal-back {
    background: none;
    border: none;
    color: var(--accent-yellow);
    font-size: 1.3rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-back:hover {
    background: var(--accent-yellow);
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    color: var(--accent-yellow);
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--accent-yellow);
    color: var(--primary-color);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    scroll-behavior: smooth;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        text-align: center;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    .detail-card.conciliacion {
        grid-column: span 1;
    }

    .metric-card {
        flex-direction: column;
        text-align: center;
    }

    .app-header {
        flex-direction: column;
        gap: 15px;
    }

    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 25px;
    }

    .header-title h1 {
        font-size: 1.3rem;
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .card-value {
        font-size: 1.8rem;
    }

    .conciliacion-body {
        padding: 20px;
    }
}
