@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Roboto:wght@400;500;700&display=swap');

:root {
    --bg-color: #F8F5F2;
    --surface-color: #FFFFFF;
    --primary-color: #B98D58;
    --text-color: #262626;
    --text-muted-color: #8A8A8A;
    --border-color: #EAEAEA;
    --accent-red: #AC3B3B;
    --accent-green: #3B8E5B;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: 'Playfair Display', serif;
}

/* --- ESTILOS DE LOGIN --- */
.login-body {
    background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('https://images.unsplash.com/photo-1599355828838-53b672a2e0f9?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1770&q=80');
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    background-color: var(--surface-color);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-container h2 {
    margin-bottom: 25px;
    font-size: 2em;
}

.login-container .form-group {
    margin-bottom: 20px;
    text-align: left;
}

.login-container .form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-muted-color);
}

.login-container .form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.2s ease;
}

.login-container .form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(185, 141, 88, 0.2);
}

/* CORRECCIÓN: Botón de login usa el color primario */
.login-container button {
    width: 100%;
    padding: 15px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.login-container button:hover {
    background-color: #A07B4E; /* Tono más oscuro del primario */
    transform: translateY(-2px);
}

/* NUEVO: Estilo para el mensaje de error del login */
.error-message {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid var(--accent-red);
    background-color: rgba(172, 59, 59, 0.08);
    color: var(--accent-red);
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
}

/* --- ESTILOS DEL DASHBOARD --- */
.dashboard-body {
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23EAEAEA' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.header-greeting h1 {
    font-size: 2.2em;
    font-weight: 700;
}

.header-greeting p {
    color: var(--text-muted-color);
    font-size: 1.1em;
}

.logout-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.logout-button i {
    font-size: 1.2em;
}

.logout-button:hover {
    background-color: #f9f9f9;
    box-shadow: var(--shadow-sm);
}

.stats-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease-in-out;
}

.stat-card .title {
    color: var(--text-muted-color);
    font-size: 0.85em;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-size: 2em;
    font-weight: 700;
}

.records-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.records-section-header h2 {
    font-size: 1.8em;
}

.search-bar {
    position: relative;
}

.search-bar .ri-search-line {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted-color);
}

.search-bar input {
    width: 100%;
    max-width: 350px;
    padding: 12px 15px 12px 45px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    background-color: var(--surface-color);
    transition: all 0.2s ease;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(185, 141, 88, 0.2);
}

.day-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    padding-bottom: 100px;
}

.no-records-container {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    background-color: var(--surface-color);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
}
.no-records-container i { font-size: 3em; color: var(--text-muted-color); }
.no-records-container h3 { margin: 10px 0; }
.no-records-container p { color: var(--text-muted-color); }

.day-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.day-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.card-content {
    padding: 25px;
    flex-grow: 1;
    cursor: pointer;
}

.card-date {
    font-weight: 500;
    color: var(--text-muted-color);
    font-size: 0.9em;
}

.card-total {
    font-size: 2.2em;
    font-weight: 700;
    margin: 8px 0;
    color: var(--text-color);
    font-family: 'Playfair Display', serif;
}

.card-subtitle {
    font-size: 0.9em;
    color: #999;
}

.card-actions {
    display: flex;
    border-top: 1px solid var(--border-color);
}

.card-action-btn {
    flex: 1;
    text-align: center;
    padding: 15px;
    text-decoration: none;
    font-size: 1.5em;
    transition: background-color 0.2s, color 0.2s;
}

.card-action-btn.pdf {
    color: var(--accent-red);
    border-right: 1px solid var(--border-color);
}

.card-action-btn.excel {
    color: var(--accent-green);
}

.card-action-btn:hover {
    background-color: #f9f9f9;
}

.fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.8em;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 999;
}

.fab:hover {
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 10px 30px rgba(185, 141, 88, 0.4);
}

/* --- ESTILOS DE MODALES --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s forwards;
    opacity: 0;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--surface-color);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    overflow: hidden;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.5em;
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted-color);
    transition: color 0.2s;
}
.close-modal-btn:hover { color: var(--text-color); }

.modal-body {
    padding: 25px;
}

.form-section {
    margin-bottom: 20px;
}

.form-section label {
    font-weight: 500;
    color: var(--text-muted-color);
    display: block;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.form-section input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.1em;
    font-family: 'Roboto', sans-serif;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.form-section input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(185, 141, 88, 0.2);
}

.service-list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px;
    display: grid;
    gap: 8px;
}

.service-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: transparent;
    border: 1px solid rgba(0,0,0,0.04);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.12s ease, transform 0.06s ease, border-color 0.12s ease;
    outline: none;
    user-select: none;
}

.service-item + .service-item { margin-top: 6px; }

/* focus visible para teclado */
.service-item:focus {
    box-shadow: 0 0 0 4px rgba(185, 141, 88, 0.12);
}

/* ESTADO SELECCIONADO: alto contraste y legible */
.service-item.selected {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: rgba(0,0,0,0.06);
    transform: translateY(-1px);
}
.service-item.selected .service-name,
.service-item.selected .service-price {
    color: #ffffff;
}

/* Si quieres borde inferior en los items (opcional) */
.service-item .service-price { font-weight: 600; }

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    background-color: #FDFBF7;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* CORRECCIÓN: Regla unificada para el total */
.total-preview strong {
    font-size: 1.5em;
    color: var(--primary-color); /* Usando el color primario */
    font-family: 'Playfair Display', serif;
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--text-color);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-primary i { font-size: 1.2em; }
.btn-primary:hover { background-color: #000; box-shadow: var(--shadow-sm); }
.btn-primary:disabled { background-color: #aaa; cursor: not-allowed; }

.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    margin-top: 15px;
}

.pagination-btn {
    background-color: var(--border-color);
    color: var(--text-muted-color);
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.pagination-btn:hover:not(:disabled) { background-color: #ddd; }
.pagination-btn:disabled { background-color: #f9f9f9; cursor: not-allowed; }
.page-info { font-size: 0.9em; font-weight: 500; color: var(--text-muted-color); }

.toast-notification {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--text-color);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    font-weight: 500;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.toast-notification.show {
    bottom: 30px;
}

/* --- ESTILOS RESPONSIVOS --- */
@media (max-width: 768px) {
    .dashboard-container { padding: 20px; }
    .main-header { flex-direction: column; align-items: flex-start; gap: 15px; }
    .stats-panel {
        grid-template-columns: 1fr; /* Cambiado a una columna */
        gap: 15px;
    }
    .stat-card {
        padding: 20px;
        text-align: left;
    }
    .stat-card .title {
        font-size: 0.8em;
    }
    .stat-card .value {
        font-size: 1.8em;
    }
    .records-section-header { flex-direction: column; align-items: flex-start; gap: 15px; }
    .search-bar { width: 100%; }
    .search-bar input { max-width: none; }
    .day-cards-grid { grid-template-columns: 1fr; }
    .fab { bottom: 20px; right: 20px; }
    .modal-footer { flex-direction: column; gap: 15px; align-items: stretch; }
}

@media (max-width: 480px) {
    .login-container {
        padding: 25px;
    }
    .login-container h2 {
        font-size: 1.8em;
    }
}
/* --- NUEVO: ESTILOS PARA EL MODAL DE WHATSAPP --- */

/* Estilo para el botón de WhatsApp en la tarjeta */
.card-action-btn.whatsapp {
    color: #25D366; /* Color oficial de WhatsApp */
    border-right: 1px solid var(--border-color);
}

/* Estilos para el grupo de entrada del teléfono */
.phone-input-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
    overflow: hidden; /* Asegura que los bordes redondeados se apliquen correctamente */
}

.phone-input-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(185, 141, 88, 0.2);
}

.phone-input-group .country-code {
    padding: 12px 15px;
    background-color: #f5f5f5;
    border-right: 1px solid var(--border-color);
    font-weight: 500;
    color: var(--text-muted-color);
}

.phone-input-group input[type="tel"] {
    width: 100%;
    padding: 12px 15px;
    border: none;
    outline: none;
    font-size: 1.1em;
    background: none;
}