/**
 * AbonaYa - Sistema de Control de Abonos y Préstamos
 * Estilos Principales
 * Paleta de Colores:
 * - Verde Esmeralda: #1ABC9C
 * - Azul Marino: #1F2A44
 * - Gris Claro: #ECF0F1
 * - Blanco: #FFFFFF
 * - Verde Oscuro: #0E7A68
 */

/* ===== RESET Y BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1ABC9C;
    --primary-dark: #0E7A68;
    --secondary-color: #1F2A44;
    --background-color: #ECF0F1;
    --white: #FFFFFF;
    --text-color: #2C3E50;
    --text-muted: #7F8C8D;
    --border-color: #BDC3C7;
    --success: #27AE60;
    --danger: #E74C3C;
    --warning: #F39C12;
    --info: #3498DB;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== WRAPPER Y LAYOUT ===== */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 260px;
    background: var(--secondary-color);
    color: var(--white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #1ABC9C 0%, #0E7A68 100%);
    padding: 3px;
}

.logo-text {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 20px;
    cursor: pointer;
}

.sidebar-nav {
    padding: 20px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin: 5px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--white);
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-nav a:hover {
    background: rgba(26, 188, 156, 0.2);
    padding-left: 25px;
}

.sidebar-nav a.active {
    background: var(--primary-color);
    border-left: 4px solid var(--primary-dark);
}

.sidebar-nav .icon {
    font-size: 20px;
    margin-right: 10px;
    width: 30px;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 0;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 20px;
    background: rgba(0, 0, 0, 0.1);
}

.user-info {
    margin-bottom: 10px;
}

.user-name {
    display: block;
    font-weight: bold;
    font-size: 14px;
}

.user-role {
    display: block;
    font-size: 12px;
    color: var(--primary-color);
}

.btn-logout {
    display: block;
    width: 100%;
    padding: 8px;
    background: var(--danger);
    color: var(--white);
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: #C0392B;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: 260px;
    transition: all 0.3s ease;
}

.top-bar {
    background: var(--white);
    padding: 15px 30px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--secondary-color);
    margin: 0;
}

.date-today {
    color: var(--text-muted);
    font-size: 14px;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--secondary-color);
    margin: 5px 0;
    transition: 0.3s;
}

.content {
    padding: 30px;
}

.footer {
    text-align: center;
    padding: 20px 30px;
    background: var(--white);
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    max-width: 1400px;
    margin: 0 auto;
}

.footer-section {
    flex: 1;
    min-width: 200px;
}

.footer-copyright {
    margin: 0;
    color: var(--text-color);
    font-weight: 500;
}

.footer-contact {
    margin: 0;
}

.footer-contact .footer-label {
    color: var(--text-color);
    font-weight: 500;
}

.footer-contact a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-contact a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.footer-dev {
    margin: 0;
    text-align: right;
}

.footer-dev a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.footer-dev a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Footer responsive */
@media (max-width: 768px) {
    .footer {
        padding: 20px 15px;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-section {
        width: 100%;
    }
    
    .footer-dev {
        text-align: center;
    }
    
    .footer-copyright,
    .footer-contact,
    .footer-dev {
        font-size: 12px;
    }
}

@media (max-width: 576px) {
    .footer {
        padding: 15px 10px;
    }
    
    .footer-content {
        gap: 10px;
    }
    
    .footer-copyright,
    .footer-contact,
    .footer-dev {
        font-size: 11px;
    }
}

/* ===== CARDS Y SECTIONS ===== */
.card {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.section-header h2,
.section-header h3 {
    margin: 0;
    color: var(--secondary-color);
}

/* ===== DASHBOARD STATS ===== */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 40px;
    margin-right: 15px;
}

.stat-content h3 {
    font-size: 28px;
    font-weight: bold;
    margin: 0;
}

.stat-content p {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
}

.stat-primary { border-left: 4px solid var(--primary-color); }
.stat-success { border-left: 4px solid var(--success); }
.stat-warning { border-left: 4px solid var(--warning); }
.stat-info { border-left: 4px solid var(--info); }
.stat-danger { border-left: 4px solid var(--danger); }

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-secondary:hover {
    background: #15202F;
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: #229954;
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #C0392B;
}

.btn-info {
    background: var(--info);
    color: var(--white);
}

.btn-info:hover {
    background: #2980B9;
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-warning:hover {
    background: #D68910;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background: var(--background-color);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    display: block;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--secondary-color);
}

.form-control {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ===== TABLES ===== */
.table-responsive {
    overflow-x: auto;
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--secondary-color);
    color: var(--white);
}

.table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background: var(--background-color);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table .actions {
    display: flex;
    gap: 5px;
}

.table-warning {
    background: rgba(243, 156, 18, 0.1);
}

.table-total {
    background: var(--background-color);
    font-weight: bold;
}

.text-center {
    text-align: center;
}

.text-danger {
    color: var(--danger);
}

.text-muted {
    color: var(--text-muted);
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    color: var(--white);
}

.badge-primary { background: var(--primary-color); }
.badge-success { background: var(--success); }
.badge-danger { background: var(--danger); }
.badge-warning { background: var(--warning); }
.badge-info { background: var(--info); }
.badge-secondary { background: var(--text-muted); }

/* ===== ALERTS ===== */
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    position: relative;
}

.alert-icon {
    font-size: 20px;
    margin-right: 10px;
}

.alert-message {
    flex: 1;
}

.alert-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

.alert-success {
    background: #D5F4E6;
    color: var(--success);
    border-left: 4px solid var(--success);
}

.alert-error {
    background: #F8D7DA;
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: #FFF3CD;
    color: #856404;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: #D1ECF1;
    color: #0C5460;
    border-left: 4px solid var(--info);
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--white);
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: var(--secondary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-close:hover {
    color: var(--danger);
}

.modal form {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.page-link {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.page-link:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.page-link.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* ===== FILTERS ===== */
.filters-section {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-form .form-control {
    flex: 1;
}

.filter-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.filter-tab:hover {
    background: var(--background-color);
}

.filter-tab.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.filters-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filters-form .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 200px;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    color: var(--secondary-color);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ===== DASHBOARD GRID ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-section {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

/* ===== TANDAS GRID ===== */
.tandas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.tanda-card {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.tanda-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.tanda-header {
    padding: 15px;
    background: var(--secondary-color);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tanda-header h3 {
    margin: 0;
    font-size: 18px;
}

.tanda-body {
    padding: 15px;
}

.tanda-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item label {
    font-size: 12px;
    color: var(--text-muted);
}

.info-item span {
    font-weight: 500;
}

.tanda-description {
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-muted);
}

.tanda-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

/* ===== DETAIL SECTIONS ===== */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.detail-section {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.detail-section h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-muted);
    font-weight: 500;
}

.info-value {
    text-align: right;
}

/* ===== PROGRESS SECTION ===== */
.progress-section {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.progress-section h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.payment-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-box {
    text-align: center;
    padding: 15px;
    border-radius: 4px;
    background: var(--background-color);
}

.stat-box label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.stat-box .amount {
    display: block;
    font-size: 20px;
    font-weight: bold;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--background-color);
    border-radius: 15px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success));
    transition: width 0.3s ease;
}

/* ===== INFO CARD ===== */
.info-card {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.info-card h3 {
    margin-bottom: 15px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-grid .info-item {
    display: flex;
    flex-direction: column;
}

.info-grid label {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.info-grid span {
    font-size: 18px;
    font-weight: bold;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.empty-state h3 {
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ===== STATS ROW ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* ===== UTILITIES ===== */
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }
.text-right { text-align: right; }

/* Touch-friendly improvements for mobile */
@media (hover: none) and (pointer: coarse) {
    /* Mejoras para dispositivos táctiles */
    .btn {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 8px 15px;
    }
    
    .form-control {
        min-height: 44px;
        padding: 12px;
        font-size: 16px;
    }
    
    .sidebar-nav a {
        min-height: 50px;
        padding: 15px 20px;
    }
    
    .filter-tab {
        min-height: 44px;
        padding: 10px 16px;
    }
    
    .page-link {
        min-height: 40px;
        min-width: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Eliminar hover effects en touch devices */
    .btn:hover,
    .page-link:hover,
    .filter-tab:hover {
        transform: none;
    }
    
    .stat-card:hover,
    .tanda-card:hover {
        transform: none;
    }
}

/* Mejoras de accesibilidad táctil */
button, a, input, select, textarea {
    -webkit-tap-highlight-color: rgba(26, 188, 156, 0.2);
}

/* Prevenir zoom en inputs en iOS */
@supports (-webkit-touch-callout: none) {
    input, select, textarea {
        font-size: 16px !important;
    }
}
