/* ==================== */
/* 1. RESET Y BASE
/* ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f7f9fc;
    color: #333;
    line-height: 1.6;
    width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* ==================== */
/* 2. CONTENEDOR
/* ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Para móviles */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
}

/* ==================== */
/* 3. HEADER
/* ==================== */
.main-header {
    background: #36618b;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100vw;
    left: 0;
    padding-left: 20px;
    padding-right: 20px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    height: 40px;
    width: auto;
    border-radius: 8px;
}

.header-logo h1 {
    margin: 0;
    font-size: 1.6em;
    font-weight: 600;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.9em;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-salir {
    background: #b12f2f;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-salir:hover {
    background: #b71c1c;
}

/* ==================== */
/* 4. TABLAS
/* ==================== */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin: 20px 0;
    overflow: hidden;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #257729;
    color: white;
}

tr:hover {
    background-color: #f1f1f1;
}

/* Morosos */
.moroso {
    background-color: #ffebee !important;
}

/* --- NUEVOS CARGOS (mejor contraste y legibilidad) --- */
.cliente { 
    background: #c8e6c9; 
    color: #1b5e20; 
    font-weight: bold;
}

.amigo { 
    background: #bbdefb; 
    color: #0d47a1; 
    font-weight: bold;
}

.familiar { 
    background: #f8bbd0; 
    color: #880e4f; 
    font-weight: bold;
}

.empresa { 
    background: #ffe0b2; 
    color: #bf360c; 
    font-weight: bold;
}

.vendedor { 
    background: #b2dfdb; 
    color: #00695c; 
    font-weight: bold;
}

.otro { 
    background: #e0e0e0; 
    color: #1a1a1a; 
    font-weight: bold;
}
/* ==================== */
/* 6. BOTONES
/* ==================== */
.btn {
    display: inline-block;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    margin: 5px 0;
    font-size: 0.9em;
    text-align: center;
}

.btn-verde { background: #28a745; color: white; }
.btn-azul { background: #007bff; color: white; }
.btn-rojo { background: #d32f2f; color: white; }

/* Botón grande (formularios) */
.btn-grande {
    padding: 12px 16px;
    font-size: 1em;
    width: 100%;
    display: block;
}

/* ==================== */
/* 7. MENSAJES
/* ==================== */
.mensaje {
    padding: 12px;
    margin: 15px 0;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
}

.mensaje.exito { background: #d4edda; color: #155724; }
.mensaje.error { background: #f8d7da; color: #721c24; }

/* ==================== */
/* 8. PAGINACIÓN
/* ==================== */
.pagination {
    text-align: center;
    margin: 20px 0;
}

.pagination a {
    margin: 0 5px;
    padding: 8px 12px;
    background: #2196F3;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
}

.pagination a:hover {
    background: #0b7dda;
}

/* ==================== */
/* 9. FORMULARIOS
/* ==================== */
.form-container {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
    transition: border 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #007bff;
    outline: none;
}

/* ==================== */
/* 10. ESTADO (Al día / Moroso)
/* ==================== */
.estado {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9em;
    text-align: center;
    min-width: 110px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.estado.aldia {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.estado.moroso {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* ==================== */
/* 11. ACCIONES (Iconos)
/* ==================== */
.acciones,
.acciones-header {
    width: 180px;
    text-align: center;
}

.acciones-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.icono {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f1f1f1;
    border-radius: 50%;
    color: #555;
    font-size: 0.9em;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.icono:hover {
    background: #007bff;
    color: white;
    transform: scale(1.1);
}

.icono.eliminar:hover {
    background: #d32f2f;
}

.icono i {
    pointer-events: none;
}

/* ==================== */
/* 12. FOOTER
/* ==================== */
.main-footer {
    background: #1a1a1a;
    color: #bbb;
    text-align: center;
    padding: 25px 20px;
    font-size: 0.9em;
    border-top: 4px solid #1976d2;
    margin-top: 40px;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

.footer-content p {
    margin: 8px 0;
}

.footer-link {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 500;
}

.footer-link:hover {
    text-decoration: underline;
    color: #2e7d32;
}

.copyright-symbol {
    color: #999;
    font-size: 0.8em;
    margin: 0 2px;
}

/* Botón de WhatsApp */
.btn-wsp {
    display: inline-block;
    background: #25D366;
    color: white !important;
    padding: 10px 18px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    margin: 5px 0;
    transition: background 0.3s;
}

.btn-wsp:hover {
    background: #128C7E;
    transform: translateY(-2px);
}

.btn-wsp i {
    margin-right: 8px;
}

.footer-more a {
    color: #2196F3;
    text-decoration: none;
    font-style: italic;
}

.footer-more a:hover {
    text-decoration: underline;
}

/* ==================== */
/* 13. LOGIN
/* ==================== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box h2 {
    margin-bottom: 20px;
    color: #1976d2;
}

.login-box input[type="text"],
.login-box input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
}

/* ==================== */
/* 14. CLIENTES.PHP
/* ==================== */
.header-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.search-form {
    margin: 0;
}

.btns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.no-data {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* ==================== */
/* 15. RESPONSIVE
/* ==================== */

/* Móviles (hasta 1000px) */
@media (max-width: 1000px) {
    .acciones { width: 150px; }
    table { font-size: 0.9em; }
}

/* Móviles (hasta 800px) */
@media (max-width: 800px) {
    .no-data, .pagination { font-size: 0.9em; }
    .btns { justify-content: center; }
    .acciones { width: 140px; }

    /* Ocultar columnas menos importantes */
    td:nth-child(4), th:nth-child(4), /* Email */
    td:nth-child(5), th:nth-child(5), /* Dirección */
    td:nth-child(6), th:nth-child(6)  /* Última compra */
    { display: none; }
}

/* Móviles pequeños (hasta 768px) */
@media (max-width: 768px) {
    .header-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .search-form input {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Móviles muy pequeños (hasta 480px) */
@media (max-width: 480px) {
    .main-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    .header-logo h1 {
        font-size: 1.3em;
    }
    .nav-user {
        font-size: 0.8em;
    }
    .btn-salir {
        padding: 6px 10px;
        font-size: 0.8em;
    }
    .form-container {
        margin: 10px;
        padding: 15px;
    }
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 12px;
        font-size: 0.95em;
    }
    .btn {
        padding: 10px;
        font-size: 0.95em;
    }
}