/* =============================================================
   Artemis Masajes — estilos base. Mobile-first, sin frameworks
   externos (se evita Bootstrap/Tailwind para mantener el proyecto
   simple, liviano y sin dependencias de build).
   ============================================================= */

:root {
    --color-primary: #6f8f74;
    --color-primary-dark: #4f6b54;
    --color-primary-light: #e7ede8;
    --color-bg: #f5f7f5;
    --color-surface: #ffffff;
    --color-text: #262a26;
    --color-text-muted: #6f766f;
    --color-border: #e0e6e1;
    --color-success: #2e9e5b;
    --color-success-bg: #e5f7ec;
    --color-danger: #d64550;
    --color-danger-bg: #fbe9ea;
    --color-warning: #b8860b;
    --color-warning-bg: #fff6e0;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 2px 10px rgba(30, 45, 33, 0.08);
    --nav-height: 62px;
    --header-height: 56px;
    --space: 16px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body { padding-bottom: calc(var(--nav-height) + 12px); }

a { color: var(--color-primary-dark); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.25; }
p { margin: 0 0 8px; }

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 18px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.app-header__title {
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header__actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
}
.icon-btn:active { background: var(--color-primary-light); }

.container { padding: 20px 18px; max-width: 900px; margin: 0 auto; }
.container > h2:first-child { margin-top: 2px; }

/* --- Bottom navigation (mobile) --- */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--nav-height);
    display: flex;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    z-index: 30;
    box-shadow: 0 -2px 10px rgba(45,30,70,0.06);
}
.bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 10.5px;
    color: var(--color-text-muted);
    padding: 6px 2px;
}
.bottom-nav__item .icon { font-size: 20px; }
.bottom-nav__item.active { color: var(--color-primary-dark); font-weight: 600; }

/* --- Cards --- */
.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 16px;
}
.card-list { display: flex; flex-direction: column; gap: 12px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}
.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    text-align: left;
}
.stat-card__label { font-size: 12px; color: var(--color-text-muted); margin-bottom: 4px; }
.stat-card__value { font-size: 22px; font-weight: 800; }
.stat-card__value.warn { color: var(--color-danger); }
.stat-card__link { display: block; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: var(--color-primary);
    color: #fff;
    min-height: 46px;
    line-height: 1.1;
}
.btn:active { background: var(--color-primary-dark); }
.btn-block { width: 100%; }
.btn-secondary { background: var(--color-primary-light); color: var(--color-primary-dark); }
.btn-outline { background: transparent; color: var(--color-primary-dark); border: 1.5px solid var(--color-primary); }
.btn-danger { background: var(--color-danger); }
.btn-success { background: var(--color-success); }
.btn-sm { padding: 8px 12px; font-size: 13px; min-height: 36px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-fab {
    position: fixed;
    right: 16px;
    bottom: calc(var(--nav-height) + 16px);
    width: 56px; height: 56px;
    border-radius: 50%;
    font-size: 26px;
    box-shadow: 0 4px 14px rgba(79,107,84,0.45);
    z-index: 25;
}

/* --- Forms --- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--color-text-muted); }
.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=number], .field input[type=date], .field input[type=time],
.field input[type=search], .field select, .field textarea {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--color-border);
    background: var(--color-surface);
    font-size: 15px;
    color: var(--color-text);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}
.field textarea { min-height: 90px; resize: vertical; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

/* Textarea de mensajes (WhatsApp): más grande y cómoda para leer/editar. */
.message-textarea {
    width: 100%;
    min-height: 140px;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--color-border);
    background: var(--color-surface);
    font-size: 15px;
    line-height: 1.5;
    color: var(--color-text);
    resize: vertical;
    font-family: inherit;
}
.message-textarea:focus { outline: none; border-color: var(--color-primary); }
.message-card--sent { background: var(--color-success-bg); border: 1.5px solid var(--color-success); }
/* Los botones dentro de una tarjeta "enviada" reafirman sus propios
   colores explícitamente: el botón outline (transparente) perdía
   contraste al dejar ver el fondo verde clarito de la tarjeta detrás
   de su texto verde oscuro. */
.message-card--sent .copy-btn { background: var(--color-primary); color: #fff; }
.message-card--sent .wa-open-btn { background: var(--color-surface); color: var(--color-primary-dark); border-color: var(--color-primary); }
.message-card--sent .message-textarea { background: var(--color-surface); color: var(--color-text); }
.help-text { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.check-row { display: flex; align-items: center; gap: 8px; }
.checkbox-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }

fieldset { border: 1.5px solid var(--color-border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 14px; }
legend { font-weight: 700; padding: 0 6px; }

/* --- Badges / status pills --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}
.badge-neutral { background: #ecebee; color: #55505c; }
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-primary { background: var(--color-primary-light); color: var(--color-primary-dark); }

/* --- Alerts / flash --- */
.alert { border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.alert-success { background: var(--color-success-bg); color: var(--color-success); }
.alert-error { background: var(--color-danger-bg); color: var(--color-danger); }

/* --- Tabs --- */
.tabs { display: flex; overflow-x: auto; gap: 4px; border-bottom: 1.5px solid var(--color-border); margin-bottom: 14px; }
.tabs a {
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-text-muted);
    white-space: nowrap;
    border-bottom: 3px solid transparent;
}
.tabs a.active { color: var(--color-primary-dark); border-bottom-color: var(--color-primary); }

/* --- Lists --- */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}
.list-item:last-child { border-bottom: none; }
.list-item__title { font-weight: 600; }
.list-item__subtitle { font-size: 12.5px; color: var(--color-text-muted); }
.empty-state { text-align: center; color: var(--color-text-muted); padding: 30px 10px; }

/* --- Search bar --- */
.search-bar { position: relative; margin-bottom: 12px; }
.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    max-height: 320px;
    overflow-y: auto;
    z-index: 40;
}
.search-results .list-item { padding: 10px 14px; cursor: pointer; }
.search-results .list-item:active { background: var(--color-primary-light); }

/* --- Modal ---
   Siempre centrado (en mobile y desktop). Se probó el patrón "hoja desde
   abajo" y quedaba corrido/desalineado en pantallas chicas, así que se
   simplificó a un diálogo centrado clásico en todos los tamaños. */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(20, 12, 35, 0.45);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    z-index: 100;
}
.modal-sheet {
    background: var(--color-surface);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: var(--radius);
    padding: 20px;
    margin: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

/* --- Toasts --- */
#toast-container { position: fixed; top: 12px; left: 12px; right: 12px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 14px;
    box-shadow: var(--shadow);
    animation: toast-in .2s ease-out;
}
.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }
@keyframes toast-in { from { opacity:0; transform: translateY(-8px);} to {opacity:1; transform:none;} }

/* --- Calendar --- */
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.calendar-nav { display: flex; align-items: center; gap: 6px; }
#cal-today.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.calendar-view-switch { display: flex; gap: 4px; background: var(--color-primary-light); border-radius: 999px; padding: 3px; }
.calendar-view-switch button {
    border: none; background: transparent; padding: 6px 12px; border-radius: 999px;
    font-size: 12.5px; font-weight: 700; color: var(--color-primary-dark); cursor: pointer;
}
.calendar-view-switch button.active { background: var(--color-primary); color: #fff; }
.calendar-date-label { font-weight: 700; font-size: 15px; text-align: center; flex: 1; }

.day-slot {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
}
.day-slot__time { width: 52px; flex-shrink: 0; font-weight: 700; font-size: 13px; color: var(--color-primary-dark); }
.day-slot__body {
    flex: 1;
    background: var(--color-primary-light);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}
.day-slot__body.status-CANCELLED { background: #f1f0f2; border-left-color: #b5b0bc; opacity: .7; }
.day-slot__body.status-COMPLETED { background: var(--color-success-bg); border-left-color: var(--color-success); }
.day-slot__body.status-NO_SHOW { background: var(--color-danger-bg); border-left-color: var(--color-danger); }
.day-slot__client { font-weight: 700; font-size: 14.5px; }
.day-slot__meta { font-size: 12.5px; color: var(--color-text-muted); margin-top: 2px; }

.week-grid { display: flex; flex-direction: column; gap: 14px; }
.week-day-header { font-weight: 700; font-size: 13px; color: var(--color-text-muted); margin-bottom: 4px; }

.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.month-cell {
    min-height: 84px;
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    box-shadow: var(--shadow);
    padding: 5px;
    font-size: 11px;
    text-align: left;
    overflow: hidden;
    cursor: pointer;
}
.month-cell.today { border: 2px solid var(--color-primary); }
.month-cell.empty { background: transparent; box-shadow: none; cursor: default; }
.month-cell__day { font-weight: 700; text-align: center; margin-bottom: 3px; }
.month-cell__client {
    background: var(--color-bg);
    border-radius: 4px;
    padding: 1px 4px;
    margin-bottom: 2px;
    font-size: 9.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.month-cell__more { font-size: 9px; color: var(--color-text-muted); text-align: center; margin-top: 1px; }

@media (min-width: 860px) {
    .month-cell { min-height: 110px; font-size: 12px; }
    .month-cell__client { font-size: 11px; padding: 2px 5px; }
}

/* --- Wizard steps --- */
.wizard-step { display: none; }
.wizard-step.active { display: block; }
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 10px 14px;
    border-radius: 999px;
    border: 1.5px solid var(--color-border);
    background: var(--color-surface);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}
.chip.selected { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.chip[disabled] { opacity: .4; cursor: not-allowed; }
.summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.summary-row strong { font-weight: 700; }

.table-scroll { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th, table.data-table td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
table.data-table th { color: var(--color-text-muted); font-size: 11.5px; text-transform: uppercase; }

.filters-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.filters-bar select, .filters-bar input { padding: 10px 12px; border-radius: var(--radius-sm); border: 1.5px solid var(--color-border); font-size: 13.5px; }

.loading-spinner {
    width: 22px; height: 22px; border-radius: 50%;
    border: 3px solid var(--color-primary-light);
    border-top-color: var(--color-primary);
    animation: spin .7s linear infinite;
    margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Auth layout --- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(160deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
}
.auth-card {
    background: var(--color-surface);
    border-radius: 18px;
    padding: 32px 24px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.2);
}
.auth-card h1 { text-align: center; font-size: 22px; margin-bottom: 4px; }
.auth-card .subtitle { text-align: center; color: var(--color-text-muted); font-size: 13.5px; margin-bottom: 24px; }

/* --- Desktop enhancements --- */
@media (min-width: 860px) {
    body { padding-bottom: 20px; padding-left: 220px; }
    .bottom-nav {
        top: 0; bottom: 0; right: auto;
        width: 220px; height: 100vh;
        flex-direction: column;
        border-top: none;
        border-right: 1px solid var(--color-border);
        padding-top: 18px;
        align-items: stretch;
    }
    .bottom-nav__item { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 12px 20px; font-size: 14px; }
    .bottom-nav__item .icon { font-size: 18px; }
    .container { max-width: 1100px; padding: 20px; }
    .stat-grid { grid-template-columns: repeat(4, 1fr); }
    .modal-sheet { max-width: 560px; }
    .btn-fab { right: 40px; bottom: 40px; }
}
