@import url('https://fonts.googleapis.com/Space+Grotesk:wght@700&display=swap');

:root {
    --bg-color: #f8fafc;
    --white: #ffffff;
    --primary: #4f46e5;
    --primary-light: #eef2ff;
    --secondary: #10b981;
    --accent: #f43f5e;
    --text-main: #0f172a;
    --text-dim: #64748b;
    --border: #e2e8f0;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Navbar */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0;
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.3rem; /* Reduced gap as requested */
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-decoration: none;
    color: var(--text-main);
    line-height: 1;
}

.nav-logo .icon {
    display: flex;
    align-items: center;
    margin-top: 2px; /* Fine-tuned vertical alignment */
}

.nav-logo img {
    height: 46px; /* Increased size for better prominence */
    width: auto;
}

.brand strong {
    color: var(--primary);
    font-weight: 700;
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
}

.badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* App Container */
.app-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 5rem 0 4rem;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.hero h1 span {
    color: var(--primary);
}

.hero-subtitle {
    color: var(--text-dim);
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Grid Layouts */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.timeline-viz-card {
    grid-column: span 2;
}

.routine-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
    margin-bottom: 5rem;
}

/* Cards */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Gauge Layout */
.main-gauge-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.sub-gauges-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.gauge-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.gauge-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.05em;
}

.gauge {
    width: 160px;
    height: 160px;
    position: relative;
    transition: var(--transition);
}

.gauge.mini {
    width: 80px;
    height: 80px;
}

.gauge svg { 
    transform: rotate(-90deg); 
}
.gauge circle { fill: none; stroke-width: 10; stroke-linecap: round; }

.gauge.mini circle { stroke-width: 12; }

.gauge .bg { stroke: #f1f5f9; }
.gauge .progress {
    stroke: var(--primary);
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1s ease-out;
}

.gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.25rem;
    font-weight: 700;
}

.gauge-value.mini {
    font-size: 1.1rem;
}

.gauge-status {
    margin-top: 1rem;
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.4rem 1.2rem;
    border-radius: 99px;
    background: #f1f5f9;
    color: var(--text-dim);
    transition: var(--transition);
}

.gauge-status.status-legendary { background: #dcfce7; color: #10b981; }
.gauge-status.status-great { background: #dcfce7; color: #059669; }
.gauge-status.status-good { background: #e0f2fe; color: #0284c7; }
.gauge-status.status-fair { background: #fef3c7; color: #d97706; }
.gauge-status.status-poor { background: #fee2e2; color: #ef4444; }

/* Insights */
.insights-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Custom Sleek Scrollbar for Activities Only */
.routine-list-content::-webkit-scrollbar {
    width: 6px;
}

.routine-list-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.routine-list-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.routine-list-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Compact Insights Grid */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.insight-tile {
    background: #f8fafc;
    border-radius: 16px;
    padding: 1rem;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.insight-tile.full-width {
    grid-column: span 2;
}

.tile-header {
    font-size: 0.75rem; /* Increased from 0.65rem */
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.05em;
}

.score-display {
    font-size: 3rem; /* Increased from 2.5rem */
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.score-display small {
    font-size: 1rem;
    color: var(--text-dim);
    font-weight: 500;
}

.mini-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
}

.mini-breakdown strong { color: var(--text-main); }

.waste-item-compact, .leak-item-compact {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.badge {
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    height: fit-content;
}

.badge.high { background: #fee2e2; color: #ef4444; }
.badge.medium { background: #fef3c7; color: #f59e0b; }
.badge.low { background: #dcfce7; color: #10b981; }

.waste-info strong { font-size: 0.85rem; display: block; }
.waste-info p { font-size: 0.75rem; color: var(--text-dim); line-height: 1.2; }

.leak-icon { font-size: 1rem; }
.leak-item-compact p { font-size: 0.75rem; color: var(--text-main); line-height: 1.3; }

.suggestion-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
}

.suggestion-list li {
    font-size: 0.8rem;
    padding-left: 1.2rem;
    position: relative;
    margin-bottom: 0.25rem;
}

.suggestion-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
}

.placeholder {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-style: italic;
    text-align: center;
    padding: 1rem 0;
}

.final-quote {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--primary);
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    text-align: center;
}

/* Form Elements */
.form-group { margin-bottom: 1.5rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

label {
    display: block;
    font-size: 0.95rem; /* Increased from 0.85rem */
    font-weight: 600;
    margin-bottom: 0.5rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.9rem 1.1rem; /* Increased padding */
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1.05rem; /* Increased from 0.95rem */
    transition: var(--transition);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.btn-primary {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

/* Content Pages */
.content-page {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.content-page.small {
    max-width: 600px;
}

.card-body {
    padding: 2rem;
    color: var(--text-dim);
    line-height: 1.6;
    font-size: 1.1rem; /* Increased for consistency */
}

textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
}

.btn-text:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

/* Routine List */
.routine-list-content {
    max-height: 520px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.routine-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 1rem;
}

.item-main {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.category-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.category-productive { background: var(--secondary); }
.category-essential { background: #3b82f6; }
.category-leisure { background: #f59e0b; }
.category-waste { background: var(--accent); }
.category-exercise { background: #a855f7; }

.item-info h4 { font-size: 1.15rem; } /* Increased */
.item-info p { font-size: 0.9rem; color: var(--text-dim); } /* Increased */

.item-date {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 4px;
}

/* Timeline Bar */
.timeline-bar {
    width: 100%;
    height: 32px;
    background: #f1f5f9;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.timeline-segment { height: 100%; }
.timeline-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.75rem;
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* Footer */
.main-footer {
    border-top: 1px solid var(--border);
    padding: 4rem 0;
    margin-top: 4rem;
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-content p {
    color: var(--text-dim);
    font-size: 1rem; /* Increased from 0.9rem */
}

.disclaimer {
    font-size: 0.8rem !important;
    opacity: 0.7;
    max-width: 500px;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 800px) {
    .dashboard-grid, .routine-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2rem; }
    .nav-links { display: none; }
    .card { padding: 1.5rem; }
    .card-body { padding: 1rem 0; }
}

@media (max-width: 768px) {
    .sub-gauges-grid {
        grid-template-columns: repeat(3, 1fr);
        justify-items: center;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .sub-gauges-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.cancel-edit-btn {
    background: #f1f5f9 !important;
    border: 1px solid var(--border) !important;
    color: var(--text-dim) !important;
    transition: var(--transition) !important;
}

.cancel-edit-btn:hover {
    background: #e2e8f0 !important;
    color: var(--text-main) !important;
}

.btn-primary.editing {
    background: var(--secondary) !important;
}

.btn-primary.editing:hover {
    background: #059669 !important;
}

.placeholder {
    color: var(--text-dim);
    text-align: center;
    padding: 2rem;
}

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: #1e293b;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastFadeOut 0.3s 2.7s ease-in forwards;
    pointer-events: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes toastSlideIn {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes toastFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
