/* ============================================================
   Diario Emocional - Estilos
   Paleta inspirada en el diario original (tonos terracota/melocotón)
============================================================ */

:root {
    --terracota: #c1604f;
    --melocoton: #f3c6a5;
    --melocoton-suave: #f8ddc4;
    --rosa: #e8a39a;
    --crema: #fdf6f0;
    --marron-oscuro: #5a4336;
    --marron-texto: #4a3a30;
    --dorado: #c79a4b;
    --blanco: #ffffff;
    --gris-borde: #e3d6cb;
    --verde-exito: #6fa97c;
    --rojo-error: #c1604f;
    --sombra: 0 4px 16px rgba(90, 67, 54, 0.08);
    --radio: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--crema);
    color: var(--marron-texto);
    line-height: 1.6;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', Georgia, serif;
    color: var(--marron-oscuro);
    margin-top: 0;
}

a { color: var(--terracota); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ---------- Topbar (público) ---------- */
.topbar {
    background: var(--blanco);
    border-bottom: 1px solid var(--gris-borde);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    color: var(--terracota);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.topbar nav a {
    margin-left: 18px;
    color: var(--marron-texto);
    font-weight: 500;
}
.topbar nav a.btn-primary {
    color: var(--blanco);
}

/* ---------- Sidebar (panel) ---------- */
.sidebar {
    width: 250px;
    background: var(--terracota);
    color: var(--blanco);
    padding: 28px 18px;
    flex-shrink: 0;
}
.sidebar .logo {
    color: var(--blanco);
    margin-bottom: 30px;
    font-size: 1.3rem;
}
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--melocoton-suave);
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 4px;
    font-size: 0.95rem;
    transition: background .15s;
}
.sidebar nav a:hover, .sidebar nav a.active {
    background: rgba(255,255,255,0.15);
    color: var(--blanco);
    text-decoration: none;
}
.sidebar .user-box {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.2);
    font-size: 0.85rem;
}
.sidebar .user-box .nombre { font-weight: 600; }

.main-content {
    flex: 1;
    padding: 30px;
    max-width: 100%;
    overflow-x: hidden;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 11px 24px;
    border-radius: 30px;
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform .12s, box-shadow .12s;
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--terracota); color: var(--blanco); }
.btn-primary:hover { background: #a8503f; color: var(--blanco); }
.btn-secondary { background: var(--melocoton); color: var(--marron-oscuro); }
.btn-outline { background: transparent; border: 2px solid var(--terracota); color: var(--terracota); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-danger { background: var(--rojo-error); color: var(--blanco); }
.btn-block { width: 100%; text-align: center; }

/* ---------- Cards ---------- */
.card {
    background: var(--blanco);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    padding: 24px;
    margin-bottom: 22px;
}
.card-header {
    background: var(--melocoton);
    color: var(--marron-oscuro);
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

/* ---------- Forms ---------- */
label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--marron-oscuro);
    font-size: 0.92rem;
}
input, select, textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--gris-borde);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    margin-bottom: 16px;
    background: var(--blanco);
    color: var(--marron-texto);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--terracota);
}
textarea { resize: vertical; min-height: 90px; }
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0 18px;
}

/* ---------- Auth pages ---------- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--melocoton-suave), var(--rosa));
    padding: 20px;
}
.auth-box {
    background: var(--blanco);
    border-radius: 20px;
    box-shadow: var(--sombra);
    padding: 40px;
    max-width: 480px;
    width: 100%;
}
.auth-box h1 {
    text-align: center;
    color: var(--terracota);
    margin-bottom: 6px;
}
.auth-sub {
    text-align: center;
    color: #9a8678;
    margin-bottom: 26px;
    font-size: 0.9rem;
}
.auth-footer {
    text-align: center;
    margin-top: 18px;
    font-size: 0.9rem;
}

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.alert-error { background: #fbe4e0; color: #a8503f; border: 1px solid #f1c1b8; }
.alert-success { background: #e3f3e6; color: #3f7a4d; border: 1px solid #c7e6cc; }

/* ---------- Dashboard widgets ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}
.stat-card {
    background: var(--blanco);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    padding: 20px;
    text-align: center;
}
.stat-card .num {
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--terracota);
    font-family: 'Playfair Display', Georgia, serif;
}
.stat-card .label {
    font-size: 0.85rem;
    color: #9a8678;
    margin-top: 4px;
}

/* ---------- Tables ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--blanco);
    border-radius: var(--radio);
    overflow: hidden;
}
th, td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--gris-borde);
    font-size: 0.9rem;
}
th {
    background: var(--melocoton);
    color: var(--marron-oscuro);
    font-weight: 600;
}
tr:hover td { background: #fdf6f0; }

/* ---------- Mood selector ---------- */
.mood-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}
.mood-option {
    text-align: center;
    padding: 14px 8px;
    border-radius: 12px;
    border: 2px solid var(--gris-borde);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--marron-texto);
    background: var(--blanco);
    transition: all .15s;
}
.mood-option .emoji { font-size: 1.8rem; display: block; margin-bottom: 4px; }
.mood-option:hover { border-color: var(--terracota); }
.mood-option.selected {
    border-color: var(--terracota);
    background: var(--melocoton-suave);
}
.mood-option input { display: none; }

/* ---------- Days of week pills ---------- */
.dias-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.dias-pills span {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--melocoton-suave);
    font-size: 0.8rem; font-weight: 700;
    color: var(--marron-oscuro);
}
.dias-pills span.active {
    background: var(--terracota);
    color: var(--blanco);
}

/* ---------- Intensity slider ---------- */
.intensity-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.intensity-wrap input[type=range] { margin: 0; flex: 1; }
.intensity-val {
    background: var(--terracota);
    color: var(--blanco);
    border-radius: 50%;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

/* ---------- Misc ---------- */
.text-muted { color: #9a8678; font-size: 0.88rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.mb-0 { margin-bottom: 0 !important; }
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--melocoton-suave);
    color: var(--marron-oscuro);
}
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #b3a297;
}
.empty-state .icon { font-size: 3rem; margin-bottom: 10px; }

/* ---------- Mobile menu ---------- */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--marron-oscuro);
    cursor: pointer;
}

@media (max-width: 900px) {
    .app-wrapper { flex-direction: column; }
    .sidebar {
        width: 100%;
        display: none;
    }
    .sidebar.open { display: block; }
    .menu-toggle { display: block; }
    .main-content { padding: 18px; }
    .topbar-panel {
        background: var(--terracota);
        color: var(--blanco);
        padding: 14px 18px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .topbar-panel .logo { color: var(--blanco); }
}
@media (min-width: 901px) {
    .topbar-panel { display: none; }
}

/* Barra de progreso (reportes admin) */
.progress-bar {
    background: var(--melocoton, #f3c6a5);
    border-radius: 20px;
    height: 14px;
    width: 100%;
    overflow: hidden;
}
.progress-bar-fill {
    background: var(--terracota, #c1604f);
    height: 100%;
    border-radius: 20px;
    transition: width 0.3s ease;
}
.progress-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
}
.progress-wrap .pct {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--terracota, #c1604f);
    white-space: nowrap;
}
