@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

* {
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.dayos-logo {
    filter: none;
    border-radius: 9px;
    object-fit: contain;
    overflow: hidden;
    mix-blend-mode: multiply;
}

.dark .dayos-logo {
    filter: invert(1);
    mix-blend-mode: screen;
}

.dayos-brand-title {
    color: #111827;
}

.dark .dayos-brand-title {
    color: #f8fafc;
}

html {
    scroll-behavior: smooth;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }
.dark ::-webkit-scrollbar-thumb:hover { background: #64748b; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

.animate-fade-in  { animation: fadeIn 0.4s ease-out both; }
.animate-slide-up { animation: slideUp 0.5s ease-out both; }
.animate-scale-in { animation: scaleIn 0.3s ease-out both; }
.animate-float    { animation: float 3s ease-in-out infinite; }

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.10s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.20s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }

.skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
    min-height: 20px;
}
.dark .skeleton {
    background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
    background-size: 200% 100%;
}

.loading-spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 2.5px solid rgba(99,102,241,0.25);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.loading-spinner-lg {
    width: 36px; height: 36px;
    border-width: 3px;
}

.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 8px 16px;
}
.typing-indicator span {
    width: 8px; height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing 1.2s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.30s; }

.glass-card {
    background: rgba(255,255,255,0.80);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 20px;
}
.dark .glass-card {
    background: rgba(30,41,59,0.80);
    border-color: rgba(71,85,105,0.35);
}

.module-card {
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.module-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.15));
    pointer-events: none;
}
.module-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 50px -10px rgba(0,0,0,0.15);
}
.dark .module-card:hover {
    box-shadow: 0 20px 50px -10px rgba(0,0,0,0.5);
}
.module-card:active {
    transform: translateY(-2px);
}

.chat-bubble {
    max-width: 82%;
    padding: 12px 18px;
    line-height: 1.6;
    font-size: 0.9375rem;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.chat-bubble-user {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: white;
    border-radius: 20px 20px 6px 20px;
    margin-left: auto;
}
.chat-bubble-ai {
    background: #f1f5f9;
    color: #1e293b;
    border-radius: 20px 20px 20px 6px;
}
.dark .chat-bubble-ai {
    background: #334155;
    color: #e2e8f0;
}

.chat-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 20px;
}
.chat-history-sidebar {
    height: calc(100vh - 180px);
    padding: 16px;
    overflow: hidden;
}
.chat-history-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
}
.dark .chat-history-heading { border-color: #334155; }
.chat-history-heading h3 { font-size: 0.9rem; font-weight: 700; }
.chat-history-heading p { color: #94a3b8; font-size: 0.7rem; margin-top: 2px; }
.chat-new-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 9px;
    border-radius: 8px;
    background: #6366f1;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}
.chat-new-button:hover { background: #4f46e5; }
.chat-history-list { display: flex; flex-direction: column; gap: 5px; padding-top: 12px; overflow-y: auto; max-height: calc(100% - 70px); }
.chat-history-item { display: flex; align-items: center; gap: 4px; border-radius: 9px; min-width: 0; }
.chat-history-item.active { background: #eef2ff; }
.dark .chat-history-item.active { background: #312e81; }
.chat-history-open {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
    padding: 10px 8px;
    color: #475569;
    text-align: left;
    font-size: 0.75rem;
}
.dark .chat-history-open { color: #cbd5e1; }
.chat-history-open span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-history-delete { padding: 8px; color: #94a3b8; border-radius: 7px; }
.chat-history-delete:hover { color: #ef4444; background: #fee2e2; }
.chat-history-empty { color: #94a3b8; font-size: 0.75rem; text-align: center; padding: 20px 4px; }

@media (max-width: 767px) {
    .chat-layout { display: flex; flex-direction: column; gap: 12px; }
    .chat-history-sidebar { height: auto; padding: 12px; }
    .chat-history-heading { align-items: center; padding-bottom: 10px; }
    .chat-history-list { flex-direction: row; max-height: none; overflow-x: auto; padding-top: 10px; }
    .chat-history-item { min-width: 180px; background: rgba(241,245,249,0.7); }
    .dark .chat-history-item { background: rgba(51,65,85,0.7); }
    .chat-history-item.active { background: #eef2ff; }
    .dark .chat-history-item.active { background: #312e81; }
    .chat-panel { height: calc(100vh - 295px) !important; }
}

.a4-paper {
    width: 210mm;
    max-width: 100%;
    min-height: 280mm;
    padding: 25mm 30mm;
    background: white;
    color: #1e293b;
    font-size: 12pt;
    line-height: 1.9;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
    border-radius: 4px;
    margin: 0 auto;
    white-space: pre-wrap;
    font-family: 'Times New Roman', 'Plus Jakarta Sans', serif;
}
@media (max-width: 768px) {
    .a4-paper {
        padding: 12mm 8mm;
        min-height: auto;
        font-size: 10.5pt;
        line-height: 1.7;
    }
}

@media print {
    body * { visibility: hidden; }
    .a4-paper, .a4-paper * { visibility: visible; }
    .a4-paper {
        position: absolute;
        left: 0; top: 0;
        width: 100%;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 20mm 25mm;
    }
    .no-print { display: none !important; }
}

.ingredient-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #4338ca;
    padding: 6px 14px;
    border-radius: 24px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}
.dark .ingredient-tag {
    background: linear-gradient(135deg, #312e81, #3730a3);
    color: #c7d2fe;
}
.ingredient-tag button {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    transition: opacity 0.2s;
}
.ingredient-tag button:hover { opacity: 1; }

.waste-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: 24px;
    font-weight: 600;
    font-size: 0.9375rem;
}
.waste-badge-green  { background: #dcfce7; color: #166534; }
.waste-badge-blue   { background: #dbeafe; color: #1e40af; }
.waste-badge-red    { background: #fee2e2; color: #991b1b; }
.waste-badge-gray   { background: #f1f5f9; color: #475569; }
.dark .waste-badge-green  { background: #064e3b; color: #6ee7b7; }
.dark .waste-badge-blue   { background: #1e3a5f; color: #93c5fd; }
.dark .waste-badge-red    { background: #7f1d1d; color: #fca5a5; }
.dark .waste-badge-gray   { background: #334155; color: #94a3b8; }

.dropzone {
    border: 2.5px dashed #cbd5e1;
    border-radius: 20px;
    padding: 48px 24px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}
.dropzone:hover,
.dropzone.drag-over {
    border-color: #6366f1;
    background: rgba(99,102,241,0.04);
}
.dark .dropzone {
    border-color: #475569;
}
.dark .dropzone:hover,
.dark .dropzone.drag-over {
    border-color: #818cf8;
    background: rgba(129,140,248,0.08);
}

.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    display: none;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid #e2e8f0;
    padding: 6px 0 max(6px, env(safe-area-inset-bottom));
}
.dark .bottom-nav {
    background: rgba(15,23,42,0.92);
    border-color: #1e293b;
}
@media (max-width: 768px) {
    .bottom-nav { display: flex; }
    .desktop-nav { display: none !important; }
    main { padding-bottom: 80px !important; }
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 0;
    font-size: 0.625rem;
    font-weight: 500;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.bottom-nav-item.active {
    color: #6366f1;
}
.dark .bottom-nav-item.active {
    color: #818cf8;
}

.module-section {
    display: none;
}
.module-section.active {
    display: block;
    animation: fadeIn 0.35s ease-out both;
}

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%; transform: translateX(-50%);
    z-index: 100;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    animation: slideUp 0.3s ease-out, fadeOut 0.3s ease-in 2.5s forwards;
    pointer-events: none;
}
.toast-success { background: #059669; color: white; }
.toast-error   { background: #dc2626; color: white; }
.toast-info    { background: #4f46e5; color: white; }
@keyframes fadeOut {
    to { opacity: 0; transform: translateY(10px) translateX(-50%); }
}

.transaction-item {
    transition: all 0.2s;
}
.transaction-item:hover {
    background: rgba(99,102,241,0.04);
}
.dark .transaction-item:hover {
    background: rgba(99,102,241,0.08);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.2s ease-out;
}
.modal-overlay.hidden {
    display: none;
}

.recipe-step {
    position: relative;
    padding-left: 36px;
}
.recipe-step::before {
    content: attr(data-step);
    position: absolute;
    left: 0; top: 2px;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: #6366f1;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mood-chip {
    padding: 8px 18px;
    border-radius: 24px;
    border: 1.5px solid #e2e8f0;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    white-space: nowrap;
}
.mood-chip:hover {
    border-color: #6366f1;
    background: #eef2ff;
}
.dark .mood-chip {
    border-color: #475569;
    background: #1e293b;
    color: #e2e8f0;
}
.dark .mood-chip:hover {
    border-color: #818cf8;
    background: #312e81;
}

.bg-gradient-recipe  { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.bg-gradient-mood    { background: linear-gradient(135deg, #818cf8, #6366f1); }
.bg-gradient-expense { background: linear-gradient(135deg, #34d399, #10b981); }
.bg-gradient-letter  { background: linear-gradient(135deg, #fb923c, #f97316); }
.bg-gradient-waste   { background: linear-gradient(135deg, #2dd4bf, #14b8a6); }

@media (max-width: 640px) {
    .a4-paper { font-size: 10pt; }
}
