
:root {
    --nt-primary:    #C8516D;
    --nt-primary-d:  #9B3050;
    --nt-primary-l:  #E8899A;
    --nt-rose:       #F2B8C6;
    --nt-bg:         #FDF0F3;
    --nt-white:      #FFFFFF;
    --nt-text:       #3D1A24;
    --nt-muted:      #9E7080;
    --nt-success:    #4CAF50;
    --nt-warning:    #FF9800;
    --nt-blue:       #2196F3;
    --nt-shadow:     0 4px 20px rgba(200,81,109,0.12);
    --nt-shadow-sm:  0 2px 10px rgba(200,81,109,0.08);
    --nt-radius:     16px;
    --nt-radius-sm:  10px;
}

* { box-sizing: border-box; }

body {
    background: var(--nt-bg);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--nt-text);
    margin: 0;
}

/* ── AUTH ─────────────────────────────────────────────────── */
.auth-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, #9B3050 0%, #C8516D 50%, #E8899A 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: 24px;
    padding: 44px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 24px 64px rgba(155,48,80,0.3);
}

.auth-brand {
    text-align: center;
    margin-bottom: 32px;
}
.auth-brand .auth-logo {
    width: 160px;
    height: auto;
    margin-bottom: 6px;
}
.auth-brand .auth-logo-text {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--nt-primary);
    letter-spacing: -1px;
    margin-bottom: 2px;
}
.auth-brand .auth-logo-text span {
    color: var(--nt-primary-d);
    font-style: italic;
}
.auth-brand p {
    color: var(--nt-muted);
    font-size: 0.82rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0;
}

.auth-card .form-control:focus {
    border-color: var(--nt-primary);
    box-shadow: 0 0 0 3px rgba(200,81,109,0.15);
}
.auth-card .btn-success {
    background: linear-gradient(135deg, var(--nt-primary-d), var(--nt-primary));
    border: none;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 12px;
    border-radius: 50px;
    font-size: 1rem;
}
.auth-card .btn-success:hover {
    background: linear-gradient(135deg, #8B2545, #B8435D);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(200,81,109,0.35);
}
.auth-card .btn-link { color: var(--nt-primary); text-decoration: none; font-weight: 600; }
.auth-card .btn-link:hover { color: var(--nt-primary-d); }

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
    background: linear-gradient(180deg, #4A0E2B 0%, #7D2448 45%, #C8516D 100%);
    width: 260px;
    min-height: 100vh;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(74,14,43,0.25);
}

.sidebar .brand {
    padding: 28px 20px 22px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar .brand .brand-logo {
    width: 130px;
    height: auto;
    filter: brightness(0) invert(1);
    margin-bottom: 4px;
}
.sidebar .brand .brand-title {
    font-size: 1.55rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    margin: 4px 0 2px;
    line-height: 1;
}
.sidebar .brand .brand-title span { font-style: italic; color: var(--nt-rose); }
.sidebar .brand .brand-sub {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.5);
    letter-spacing: 2px;
    text-transform: uppercase;
}
.sidebar .brand small {
    display: block;
    color: rgba(255,255,255,0.65);
    font-size: 0.8rem;
    margin-top: 6px;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.7);
    padding: 13px 22px;
    display: flex;
    align-items: center;
    gap: 13px;
    font-size: 0.93rem;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}
.sidebar .nav-link i { font-size: 1.15rem; width: 22px; text-align: center; }
.sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,0.1); }
.sidebar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.15);
    border-left-color: var(--nt-rose);
    font-weight: 600;
}

.sidebar .sidebar-footer {
    margin-top: auto;
    padding: 16px 18px;
    border-top: 1px solid rgba(255,255,255,0.12);
}
.sidebar .sidebar-footer .badge { font-size: 0.75rem; background: rgba(255,255,255,0.2) !important; }
.sidebar .sidebar-footer .btn-outline-light {
    border-color: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.8);
    border-radius: 50px;
    font-size: 0.85rem;
}
.sidebar .sidebar-footer .btn-outline-light:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ── MAIN CONTENT ─────────────────────────────────────────── */
.main-content {
    margin-left: 260px;
    padding: 32px 36px;
    min-height: 100vh;
}

.page-header { margin-bottom: 28px; }
.page-header h2 {
    font-weight: 800;
    color: var(--nt-primary-d);
    margin-bottom: 4px;
    font-size: 1.65rem;
}
.page-header p { color: var(--nt-muted); margin: 0; }

/* ── NT-CARD ──────────────────────────────────────────────── */
.nt-card {
    border: none;
    border-radius: var(--nt-radius);
    box-shadow: var(--nt-shadow-sm);
    background: var(--nt-white);
    padding: 24px;
}
.nt-card h5 { color: var(--nt-primary-d); font-weight: 700; }

/* ── CHECK CARDS ──────────────────────────────────────────── */
.check-card {
    border: none !important;
    border-radius: 14px !important;
    box-shadow: var(--nt-shadow-sm) !important;
    cursor: pointer;
    transition: transform 0.18s, box-shadow 0.18s;
    border-left: 4px solid #f0d0d8 !important;
    background: #fff;
}
.check-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(200,81,109,0.16) !important;
}
.check-card.done {
    background: linear-gradient(135deg, #fff5f7, #ffe8ed) !important;
    border-left-color: var(--nt-primary) !important;
}
.check-icon {
    font-size: 2rem;
    transition: transform 0.25s;
    display: inline-block;
    min-width: 36px;
    text-align: center;
}
.check-card.done .check-icon { transform: scale(1.2); }
.check-card .fw-semibold { color: var(--nt-text); }

/* checkbox rose */
.form-check-input:checked {
    background-color: var(--nt-primary);
    border-color: var(--nt-primary);
}
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(200,81,109,0.2); }

/* ── WATER BUTTONS ────────────────────────────────────────── */
.water-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 56px;
    border-radius: 14px;
    border: 2px solid #b3d9f7;
    background: #eaf5fd;
    color: #90caf9;
    cursor: pointer;
    transition: all 0.18s ease;
    font-size: 1.4rem;
    gap: 1px;
    padding: 0;
}
.water-btn:hover {
    transform: scale(1.1);
    border-color: #42a5f5;
    background: #d6eeff;
    color: #1976d2;
}
.water-btn.filled {
    background: linear-gradient(135deg, #42a5f5, #1565c0);
    border-color: #1565c0;
    color: #fff;
    box-shadow: 0 3px 10px rgba(21,101,192,0.35);
}
.water-btn .water-ml {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1;
}
/* ── MEAL ICON ────────────────────────────────────────────── */
.meal-icon-wrap {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.meal-emoji {
    font-size: 2rem;
    line-height: 1;
}
.meal-done-badge {
    position: absolute;
    bottom: -2px;
    right: -4px;
    background: #4caf50;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

/* ── METRIC CARDS ─────────────────────────────────────────── */
.metric-card {
    border: none !important;
    border-radius: var(--nt-radius) !important;
    box-shadow: var(--nt-shadow-sm) !important;
    background: #fff;
    padding: 22px;
    text-align: center;
}
.metric-value {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--nt-primary);
    line-height: 1.1;
}
.metric-label {
    color: var(--nt-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 4px;
}

/* ── MACRO BARS ───────────────────────────────────────────── */
.macro-bar-wrap {
    background: #f5e0e5;
    border-radius: 50px;
    height: 9px;
    overflow: hidden;
}
.macro-bar {
    height: 100%;
    border-radius: 50px;
    transition: width 0.6s ease;
}

/* ── MOTIV ALERT ──────────────────────────────────────────── */
.motiv-alert {
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 700;
    animation: slideDown 0.35s ease;
    border: none;
}
.alert-success.motiv-alert {
    background: linear-gradient(135deg, #ffe0e8, #ffc8d5);
    color: var(--nt-primary-d);
}
.alert-warning.motiv-alert {
    background: linear-gradient(135deg, #fff3cd, #ffe5a0);
    color: #856404;
}
@keyframes slideDown {
    from { opacity:0; transform:translateY(-15px) scale(0.97); }
    to   { opacity:1; transform:translateY(0) scale(1); }
}

/* ── FORMS ────────────────────────────────────────────────── */
.form-control:focus, .form-select:focus {
    border-color: var(--nt-primary-l);
    box-shadow: 0 0 0 3px rgba(200,81,109,0.12);
}
.btn-success {
    background: linear-gradient(135deg, var(--nt-primary-d), var(--nt-primary));
    border: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-success:hover {
    background: linear-gradient(135deg, #8B2545, #B8435D);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(200,81,109,0.3);
}
.btn-outline-success {
    color: var(--nt-primary);
    border-color: var(--nt-primary);
    border-radius: 50px;
    font-weight: 600;
}
.btn-outline-success:hover {
    background: var(--nt-primary);
    border-color: var(--nt-primary);
    transform: translateY(-1px);
}

/* ── TABS ─────────────────────────────────────────────────── */
.nav-tabs .nav-link { border-radius: 10px 10px 0 0; font-weight: 500; color: var(--nt-muted); }
.nav-tabs .nav-link.active { color: var(--nt-primary-d); border-bottom-color: #fff; font-weight: 700; }
.nav-tabs .nav-link:hover { color: var(--nt-primary); }
.nav-pills .nav-link { border-radius: 50px; color: var(--nt-muted); font-weight: 500; }
.nav-pills .nav-link.active { background: var(--nt-primary); font-weight: 700; }

/* ── TABLES ───────────────────────────────────────────────── */
.table thead { background: #fff0f4; }
.table thead th { color: var(--nt-primary-d); font-weight: 700; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.5px; }
.table-hover tbody tr:hover { background: #fff7f9; }
.badge.bg-success { background: var(--nt-primary) !important; }

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: var(--nt-bg); }
::-webkit-scrollbar-thumb { background: var(--nt-rose); border-radius: 10px; }

/* ── BLAZOR ERROR ─────────────────────────────────────────── */
#blazor-error-ui {
    background: #fff0f4;
    bottom:0; left:0;
    box-shadow: 0 -2px 10px rgba(200,81,109,0.2);
    display:none; padding:.6rem 1.25rem .7rem;
    position:fixed; width:100%; z-index:1000;
}
#blazor-error-ui .dismiss { cursor:pointer; position:absolute; right:.75rem; top:.5rem; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 991px) {
    .sidebar { width: 220px; }
    .main-content { margin-left: 220px; padding: 24px 20px; }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0; left: -260px;
        width: 260px;
        transition: left 0.3s ease;
        z-index: 999;
    }
    .sidebar.open { left: 0; }
    .main-content { margin-left: 0; padding: 16px; }
    .mobile-nav-bar {
        display: flex !important;
        position: fixed;
        top: 0; left: 0; right: 0;
        background: linear-gradient(90deg, #4A0E2B, #C8516D);
        height: 58px;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
        z-index: 998;
        box-shadow: 0 2px 10px rgba(74,14,43,0.3);
    }
    .mobile-nav-bar .brand-mobile {
        color: #fff;
        font-weight: 800;
        font-size: 1.2rem;
    }
    .mobile-nav-bar .brand-mobile span { font-style: italic; color: var(--nt-rose); }
    .mobile-nav-bar .btn-menu { background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }
    .main-content { padding-top: 74px !important; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(74,14,43,0.4);
        z-index: 998;
    }
    .sidebar-overlay.show { display: block; }
    .auth-card { padding: 28px 20px; }
    .metric-value { font-size: 1.5rem; }
}

@media (min-width: 769px) {
    .mobile-nav-bar { display: none !important; }
    .sidebar-overlay { display: none !important; }
}

/* ── Supplement rows inside meal cards ───────────────────── */
.sup-row {
    cursor: pointer;
    border-radius: 8px;
    padding: 6px 8px;
    transition: background 0.15s;
}
.sup-row:hover { background: rgba(200,81,109,0.06); }
.sup-row.sup-done { background: rgba(200,81,109,0.08); }
.sup-row.sup-done .fw-semibold { color: var(--nt-primary-d); text-decoration: line-through; opacity: 0.7; }

/* ── Autocomplete dropdown ────────────────────────────────── */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--nt-rose);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(200,81,109,0.15);
    list-style: none;
    margin: 0;
    padding: 4px 0;
    z-index: 1050;
    max-height: 260px;
    overflow-y: auto;
}

.autocomplete-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--nt-text);
    transition: background 0.15s;
}

.autocomplete-list li:hover {
    background: #fff0f5;
    color: var(--nt-primary-d);
}

.autocomplete-list li .ac-emoji {
    font-size: 1.1rem;
    min-width: 24px;
    text-align: center;
}

/* ── PWA INSTALL BANNER ─────────────────────────────────────── */
.pwa-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    background: #fff;
    border-top: 2px solid var(--nt-rose);
    box-shadow: 0 -4px 20px rgba(200,81,109,0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    gap: 12px;
    animation: slideUp 0.35s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.pwa-banner-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
}

.pwa-banner-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pwa-banner-text strong {
    font-size: .95rem;
    color: var(--nt-primary-d);
    white-space: nowrap;
}

.pwa-banner-text small {
    color: var(--nt-muted);
    font-size: .78rem;
}

.pwa-banner-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.pwa-btn-install {
    background: var(--nt-primary);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 16px;
    font-weight: 600;
    font-size: .85rem;
    white-space: nowrap;
}
.pwa-btn-install:hover { background: var(--nt-primary-d); color:#fff; }

.pwa-btn-dismiss {
    color: var(--nt-muted);
    font-size: .85rem;
    padding: 4px 8px;
    text-decoration: none;
}
.pwa-btn-dismiss:hover { color: var(--nt-primary); }

/* On desktop: banner floats bottom-right */
@media (min-width: 768px) {
    .pwa-banner {
        left: auto;
        right: 24px;
        bottom: 24px;
        width: 360px;
        border-radius: 16px;
        border: 1px solid var(--nt-rose);
        border-top: 2px solid var(--nt-rose);
    }
}

/* Safe area for phones with notch */
.pwa-banner {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

/* ── RECONEXIÓN BLAZOR — toast pequeño abajo ────────────────── */
#components-reconnect-modal {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: #fff;
    border: 1px solid var(--nt-rose);
    border-radius: 30px;
    padding: 10px 20px;
    box-shadow: 0 4px 20px rgba(200,81,109,0.2);
    font-size: .88rem;
    color: var(--nt-primary-d);
    white-space: nowrap;
    pointer-events: none;
}

/* Spinner inline */
.reconnect-content {
    display: none;
    align-items: center;
    gap: 8px;
}
.reconnect-failed-content {
    display: none;
    align-items: center;
    gap: 8px;
}
.reconnect-reload {
    color: var(--nt-primary);
    font-weight: 600;
    pointer-events: all;
    text-decoration: none;
}
.reconnect-spinner {
    width: 14px; height: 14px;
    border: 2px solid var(--nt-rose);
    border-top-color: var(--nt-primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Clases que Blazor aplica automáticamente */
#components-reconnect-modal.components-reconnect-show {
    display: flex;
}
#components-reconnect-modal.components-reconnect-show .reconnect-content {
    display: flex;
}
#components-reconnect-modal.components-reconnect-hide {
    display: none;
}
#components-reconnect-modal.components-reconnect-failed {
    display: flex;
    border-color: #f44336;
    color: #c62828;
    pointer-events: all;
}
#components-reconnect-modal.components-reconnect-failed .reconnect-failed-content {
    display: flex;
}
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
    border-color: #f44336;
    color: #c62828;
}
#components-reconnect-modal.components-reconnect-rejected .reconnect-failed-content {
    display: flex;
}

/* ── BANNER iOS ─────────────────────────────────────────────── */
.pwa-banner-ios .pwa-banner-text small {
    font-size: .82rem;
}
.pwa-banner-ios .bi-box-arrow-up {
    font-size: 1rem;
    vertical-align: middle;
    color: var(--nt-primary);
}

/* ── OVERRIDE: ocultar el toast de reconexión durante el intento ── */
/* Como auto-recargamos al fallar, el usuario no necesita ver el mensaje */
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: none !important;
}
