/* ==========================================================================
   HabitFlow Pro - Hoja de Estilos Completa y Autónoma (Sin dependencias CDN)
   ========================================================================== */
:root {
    --bg-main: #090d16;
    --bg-card: rgba(17, 24, 39, 0.90);
    --bg-card-solid: #111827;
    --bg-subtle: rgba(31, 41, 55, 0.70);
    --border-color: rgba(255, 255, 255, 0.09);
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
}

html.light {
    --bg-main: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-solid: #ffffff;
    --bg-subtle: rgba(226, 232, 240, 0.75);
    --border-color: rgba(15, 23, 42, 0.12);
    --text-main: #0f172a;
    --text-muted: #475569;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    transition: background-color 0.25s ease, color 0.25s ease;
    overflow-x: hidden;
    min-height: 100vh;
    padding-bottom: 4rem;
    line-height: 1.5;
}

h1, h2, h3, h4, p {
    margin: 0;
}

/* Visibilidad y Display */
.hidden { display: none !important; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.block { display: block; }

/* Posicionamiento */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.bottom-5 { bottom: 1.25rem; }
.right-5 { right: 1.25rem; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

/* Flexbox y Grid */
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.shrink-0 { flex-shrink: 0; }
.self-start { align-self: flex-start; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-baseline { align-items: baseline; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }

/* Espaciados y Gaps */
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-2\.5 { gap: 0.625rem; }
.gap-3 { gap: 0.75rem; }
.gap-3\.5 { gap: 0.875rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.space-y-2\.5 > * + * { margin-top: 0.625rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

/* Dimensiones */
.w-full { width: 100%; }
.w-1\.5 { width: 0.375rem; }
.h-1\.5 { height: 0.375rem; }
.w-2 { width: 0.5rem; }
.h-2 { height: 0.5rem; }
.w-3 { width: 0.75rem; }
.h-3 { height: 0.75rem; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.w-7 { width: 1.75rem; }
.h-7 { height: 1.75rem; }
.w-9 { width: 2.25rem; }
.h-9 { height: 2.25rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
.w-24 { width: 6rem; }
.w-32 { width: 8rem; }
.h-32 { height: 8rem; }
.h-36 { height: 9rem; }
.h-52 { height: 13rem; }
.h-full { height: 100%; }

.max-w-md { max-width: 28rem; }
.max-w-7xl { max-width: 80rem; }
.max-w-\[44px\] { max-width: 44px; }
.min-w-0 { min-width: 0; }
.min-w-\[54px\] { min-width: 54px; }
.min-w-\[80px\] { min-width: 80px; }
.min-w-\[95px\] { min-width: 95px; }
.min-w-\[115px\] { min-width: 115px; }
.min-w-\[155px\] { min-width: 155px; }
.min-w-\[230px\] { min-width: 230px; }

/* Márgenes y Paddings */
.mx-auto { margin-left: auto; margin-right: auto; }
.my-4 { margin-top: 1rem; margin-bottom: 1rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-2\.5 { margin-top: 0.625rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-5 { margin-top: 1.25rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-1\.5 { margin-bottom: 0.375rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }

.p-0\.5 { padding: 0.125rem; }
.p-1 { padding: 0.25rem; }
.p-1\.5 { padding: 0.375rem; }
.p-2 { padding: 0.5rem; }
.p-2\.5 { padding: 0.625rem; }
.p-3\.5 { padding: 0.875rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-7 { padding: 1.75rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-1\.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-3\.5 { padding-left: 0.875rem; padding-right: 0.875rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-3\.5 { padding-top: 0.875rem; padding-bottom: 0.875rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-3 { padding-top: 0.75rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }
.pb-16 { padding-bottom: 4rem; }

/* Bordes y Redondeos */
.rounded-sm { border-radius: 0.18rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-3xl { border-radius: 1.5rem; }
.rounded-full { border-radius: 9999px; }
.border { border: 1px solid var(--border-color); }
.border-b { border-bottom: 1px solid var(--border-color); }
.border-t { border-top: 1px solid var(--border-color); }
.border-collapse { border-collapse: collapse; }
.border-indigo-500\/30, .border-indigo-500\/40 { border-color: rgba(99, 102, 241, 0.38); }
.border-emerald-500\/30 { border-color: rgba(16, 185, 129, 0.35); }
.border-amber-500\/30 { border-color: rgba(245, 158, 11, 0.35); }
.border-gray-700, .border-gray-700\/70 { border-color: rgba(55, 65, 81, 0.7); }

/* Tipografía y Alineación */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.align-middle { vertical-align: middle; }
.text-\[10px\] { font-size: 10px; }
.text-\[11px\] { font-size: 11px; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-tight { letter-spacing: -0.025em; }
.leading-snug { line-height: 1.35; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Efectos y Utilidades */
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.cursor-pointer { cursor: pointer; }
.pointer-events-none { pointer-events: none; }
.blur-sm { filter: blur(4px); }
.backdrop-blur-sm, .backdrop-blur-md { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.grayscale { filter: grayscale(100%); }
.opacity-45 { opacity: 0.45; }
.opacity-0 { opacity: 0; }
.translate-y-2 { transform: translateY(0.5rem); }
.-rotate-90 { transform: rotate(-90deg); }
.scale-110 { transform: scale(1.1); }
.transition, .transition-all { transition: all 0.25s ease; }
.shadow, .shadow-sm { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
.shadow-lg, .shadow-2xl { box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.45); }

/* Paleta de Colores */
.text-white { color: #ffffff; }
.text-black { color: #000000; }
.text-gray-300 { color: #d1d5db; }
.text-gray-400 { color: var(--text-muted); }
.text-gray-500 { color: #6b7280; }
.text-indigo-300 { color: #a5b4fc; }
.text-indigo-400 { color: #818cf8; }
.text-emerald-400 { color: #34d399; }
.text-amber-400 { color: #fbbf24; }
.text-rose-400 { color: #fb7185; }

.hover\:text-white:hover { color: #ffffff; }
.hover\:text-indigo-400:hover { color: #818cf8; }
.hover\:text-rose-400:hover { color: #fb7185; }
.hover\:scale-110:hover { transform: scale(1.1); }
.hover\:bg-white\/\[0\.02\]:hover { background-color: rgba(255, 255, 255, 0.025); }

.bg-indigo-600 { background-color: #4f46e5; }
.bg-indigo-600:hover, .hover\:bg-indigo-500:hover { background-color: #6366f1; }
.bg-emerald-600 { background-color: #059669; }
.bg-emerald-600:hover, .hover\:bg-emerald-500:hover { background-color: #10b981; }
.bg-emerald-400 { background-color: #34d399; }
.bg-amber-500 { background-color: #f59e0b; }
.bg-amber-400 { background-color: #fbbf24; }
.bg-rose-600 { background-color: #e11d48; }
.bg-gray-500\/30 { background-color: rgba(107, 114, 128, 0.35); }
.bg-gray-800, .bg-gray-800\/60, .bg-gray-800\/70 { background-color: rgba(31, 41, 55, 0.78); }
.bg-indigo-900, .bg-indigo-900\/80 { background-color: #312e81; }
.bg-indigo-700 { background-color: #4338ca; }
.bg-indigo-500 { background-color: #6366f1; }
.bg-indigo-500\/10 { background-color: rgba(99, 102, 241, 0.13); }
.bg-indigo-500\/20 { background-color: rgba(99, 102, 241, 0.22); }
.bg-emerald-500\/15 { background-color: rgba(16, 185, 129, 0.16); }
.bg-amber-500\/15 { background-color: rgba(245, 158, 11, 0.16); }
.bg-black\/70, .bg-black\/75 { background-color: rgba(0, 0, 0, 0.76); }

/* Gradientes */
.bg-gradient-to-br { background: linear-gradient(135deg, #6366f1, #9333ea); }
.bg-gradient-to-r { background: linear-gradient(90deg, #6366f1, #10b981); }
.bg-gradient-to-t.from-indigo-600 { background: linear-gradient(to top, #4f46e5, #818cf8); }
.bg-gradient-to-t.from-emerald-600 { background: linear-gradient(to top, #059669, #34d399); }

/* Formularios y Controles */
button, input, select, textarea {
    font-family: inherit;
    color: inherit;
    background: transparent;
    border: none;
    outline: none;
}
button { cursor: pointer; }
input, select, textarea { color: var(--text-main); }
select option { background-color: var(--bg-card-solid); color: var(--text-main); }
input[type="range"] { accent-color: #6366f1; cursor: pointer; }
input[type="checkbox"] { accent-color: #6366f1; width: 1rem; height: 1rem; cursor: pointer; }

.stroke-\[2\.6\] { stroke-width: 2.6; }
.ring-2 { box-shadow: 0 0 0 2px #6366f1; }
.ring-white { box-shadow: 0 0 0 2px #ffffff; }

/* Componentes Principales */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.35);
}

.subtle-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
}
.subtle-box:hover {
    border-color: rgba(99, 102, 241, 0.35);
}

.check-btn {
    transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}
.check-btn:hover { transform: scale(1.08); }
.check-btn:active { transform: scale(0.92); }
.group\/cell:hover .group-hover\/cell\:opacity-100 { opacity: 1; }

.note-dot {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 9px;
    height: 9px;
    border-radius: 9999px;
    background-color: #f59e0b;
    border: 2px solid var(--bg-card-solid);
}

/* Heatmap Grid */
.heatmap-grid {
    display: grid;
    grid-template-rows: repeat(7, 13px);
    grid-auto-flow: column;
    grid-auto-columns: 13px;
    gap: 3px;
}
.heatmap-cell {
    width: 13px;
    height: 13px;
    border-radius: 3px;
    transition: transform 0.15s ease;
}
.heatmap-cell:hover { transform: scale(1.3); z-index: 10; }

/* Media Queries Responsivas */
@media (min-width: 640px) {
    .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
    .sm\:text-2xl { font-size: 1.5rem; }
    .sm\:text-sm { font-size: 0.875rem; }
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
    .md\:flex-row { flex-direction: row; }
    .md\:items-center { align-items: center; }
    .md\:self-auto { align-self: auto; }
}
@media (min-width: 1024px) {
    .lg\:flex-row { flex-direction: row; }
    .lg\:items-center { align-items: center; }
    .lg\:justify-between { justify-content: space-between; }
    .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lg\:col-span-2 { grid-column: span 2 / span 2; }
}

@media print {
    .no-print { display: none !important; }
    body { background: #ffffff !important; color: #000000 !important; }
    .glass-card { background: #ffffff !important; border: 1px solid #cbd5e1 !important; box-shadow: none !important; break-inside: avoid; }
}

/* HabitFlow Pro v1.1.0: vista diaria, navegación móvil y acciones para compartir */
[hidden] { display: none !important; }
.brand-logo { width: 48px; height: 48px; display: block; border-radius: 12px; flex-shrink: 0; }
.header-actions { row-gap: .5rem; }
.view-switch { display: inline-flex; padding: 4px; border-radius: 13px; background: var(--bg-subtle); border: 1px solid var(--border-color); gap: 2px; }
.view-switch button { padding: .55rem 1rem; border-radius: 10px; color: var(--text-muted); font-size: .8rem; font-weight: 700; transition: background .2s ease, color .2s ease; }
.view-switch button.active { background: #4f46e5; color: #fff; box-shadow: 0 3px 10px rgba(79,70,229,.23); }
.share-results-btn { padding: .7rem 1rem; border-radius: 12px; background: #059669; color: white; font-size: .82rem; font-weight: 700; }
.share-results-btn:hover { background: #047857; }
.share-results-btn:disabled { opacity: .5; cursor: wait; }
.swipe-hint { display: none; align-items: center; justify-content: center; gap: .55rem; padding: .65rem .75rem; border-radius: 12px; background: rgba(99,102,241,.13); border: 1px solid rgba(99,102,241,.35); color: var(--text-main); font-size: .79rem; font-weight: 600; }
.swipe-hint span { font-size: 1.25rem; color: #818cf8; }
.habit-table-scroller { overscroll-behavior-inline: contain; scrollbar-width: thin; scrollbar-color: #818cf8 transparent; }
.habit-table-scroller:focus-visible { outline: 2px solid #818cf8; outline-offset: 3px; }
.habit-table-scroller table:not(.daily-table) { min-width: 975px; }
.daily-table { table-layout: auto; min-width: 0; }
.daily-table th:first-child, .daily-table td:first-child { width: 100%; }
.daily-table td:nth-child(2) { min-width: 70px; }
.daily-table th:nth-child(2) { min-width: 70px; }
.daily-table td:last-child { min-width: 78px; }
.note-action { opacity: .85; min-height: 24px; }
@media (max-width: 767px) {
  .swipe-hint:not([hidden]) { display: flex; }
  .habit-nav-bar { align-items: flex-start; }
  .daily-table td:first-child { padding-left: .5rem; padding-right: .35rem; }
  .daily-table th:first-child { padding-left: .5rem; }
  .daily-table .truncate { max-width: 42vw; }
  .header-actions { width: 100%; }
  .header-actions button:first-child { margin-right: auto; }
  .habit-table-scroller table:not(.daily-table) { border-right: 2px solid rgba(129,140,248,.45); }
}
@media (min-width: 768px) { .swipe-hint { display: none !important; } }

.habit-edit-name { max-width: 100%; display: block; text-align: left; background: transparent; cursor: pointer; }
.habit-edit-name:hover { color: #a5b4fc; }
.edit-hint { font-size: .85em; opacity: .65; padding-left: .15rem; }
.daily-table td:nth-child(2) { min-width: 78px; }
@media (max-width: 767px) { .daily-table th:first-child, .daily-table td:first-child { width: auto; } .daily-table .truncate { max-width: 55vw; } }
