@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
    /* Color Palette */
    --color-bg: #121212;
    --color-surface: #1e1e1e;
    --color-primary: #9fa8da;
    --color-accent: #69f0ae;
    /* Zelená - Jídlo/Hubnutí */
    --color-danger: #ff5252;
    /* Červená - Půst */
    --color-blue: #448aff;
    /* Modrá - Ketóza/Fáze */
    --color-text: #e3e2e6;
    --color-text-dim: #a0a0a0;
    --color-border: #333333;
    --color-input-bg: #2c2c2c;

    --radius-md: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    height: 100vh;
    overflow: hidden;
}

/* FIX: Oprava problikávání sekcí */
.hidden {
    display: none !important;
}

/* Utility */
.text-center {
    text-align: center;
}

.text-danger {
    color: var(--color-danger);
}

.text-success {
    color: var(--color-accent);
}

.full-width {
    width: 100%;
    margin-top: 10px;
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 600px;
    margin: 0 auto;
    background: var(--color-bg);
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 90px;
}

.section-title {
    margin: 10px 0 15px 4px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-text-dim);
}

/* Header */
.app-bar {
    background: var(--color-surface);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
}

.app-title-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-logo {
    color: var(--color-accent);
    font-size: 26px;
}

.app-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    font-size: 0.85rem;
    background: #333;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    min-width: 60px;
    text-align: center;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.status-icon {
    font-size: 20px;
    margin-right: 10px;
    color: #666;
}

.status-icon.synced {
    color: #4CAF50;
}

.status-icon.syncing {
    color: #FFC107;
}

.status-icon.offline {
    color: #F44336;
}

/* Tabs */
.tabs-container {
    background: var(--color-surface);
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: 600px;
    z-index: 20;
}

.tab {
    flex: 1;
    padding: 10px 0;
    background: none;
    border: none;
    color: var(--color-text-dim);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: color 0.3s;
}

.tab.active {
    color: var(--color-primary);
}

.tab.active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
}

/* Cards & Forms */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
}

.card-header {
    font-weight: bold;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-dim);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--color-text-dim);
    margin-bottom: 6px;
}

.form-input,
select.form-input {
    width: 100%;
    background: var(--color-input-bg);
    border: 1px solid var(--color-border);
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    font-size: 1rem;
}

.btn-primary {
    background: var(--color-primary);
    color: #000;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-primary:active {
    opacity: 0.8;
}

.btn-text {
    background: none;
    border: none;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 10px;
}

/* Weight Inputs */
.weight-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    flex: 1;
    background: var(--color-input-bg);
    border: 1px solid var(--color-border);
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    font-size: 1rem;
    font-family: sans-serif;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.stat-box {
    background: var(--color-surface);
    padding: 12px 8px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--color-border);
}

.stat-box small {
    display: block;
    color: var(--color-text-dim);
    font-size: 0.7rem;
    margin-bottom: 4px;
}

.stat-box strong {
    font-size: 1rem;
}

/* Timer Visuals */
.timer-wrapper {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 20px auto;
}

.timer-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.timer-bg {
    fill: none;
    stroke: #333;
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: var(--color-accent);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.5s ease;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

#timerValue {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

#timerLabel {
    font-size: 0.9rem;
    color: var(--color-text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Phase Display (NOVÉ) */
.phase-container {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-top: 5px;
    border: 1px solid var(--color-border);
    text-align: left;
    max-width: 90%;
}

.phase-icon {
    color: var(--color-blue);
    font-size: 28px;
}

.phase-info {
    display: flex;
    flex-direction: column;
}

.phase-label {
    font-size: 0.75rem;
    color: var(--color-text-dim);
    text-transform: uppercase;
}

.phase-value {
    font-weight: bold;
    font-size: 0.95rem;
    color: var(--color-blue);
}

/* Status Logic & Colors */
.status-chip {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.status-eating .timer-progress {
    stroke: var(--color-accent);
}

.status-eating #statusBadge {
    background: rgba(105, 240, 174, 0.15);
    color: var(--color-accent);
}

.status-fasting .timer-progress {
    stroke: var(--color-danger);
}

.status-fasting #statusBadge {
    background: rgba(255, 82, 82, 0.15);
    color: var(--color-danger);
}

/* Lists & SOS */
.sos-card {
    border: 1px solid var(--color-danger);
    background: rgba(255, 82, 82, 0.05);
}

.sos-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.sos-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 4px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    font-size: 0.8rem;
}

.shop-item {
    display: flex;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    user-select: none;
}

.checkbox-circle {
    width: 22px;
    height: 22px;
    border: 2px solid var(--color-text-dim);
    border-radius: 50%;
    margin-right: 14px;
    flex-shrink: 0;
}

.shop-item.checked .checkbox-circle {
    background: var(--color-accent);
    border-color: var(--color-accent);
    position: relative;
}

.shop-item.checked span {
    text-decoration: line-through;
    opacity: 0.4;
}

/* RECEPTY (AKORDEON) */
.day-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    margin-bottom: 12px;
    overflow: hidden;
}

.day-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    font-weight: bold;
}

.day-header.completed {
    color: var(--color-accent);
}

.day-content {
    display: none;
    padding: 0 16px 16px 16px;
    border-top: 1px solid var(--color-border);
    animation: fadeIn 0.3s ease;
}

.day-card.open .day-content {
    display: block;
}

.day-card.open .day-header {
    background: rgba(255, 255, 255, 0.05);
}

.recipe-item {
    margin-top: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
}

.recipe-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.recipe-title {
    display: flex;
    align-items: center;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.recipe-meta {
    font-size: 0.8rem;
    color: var(--color-primary);
    margin-bottom: 6px;
    display: block;
    margin-left: 36px;
}

.recipe-desc {
    font-size: 0.9rem;
    color: var(--color-text-dim);
    margin-left: 36px;
    line-height: 1.4;
}

.recipe-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-text-dim);
    border-radius: 6px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    flex-shrink: 0;
}

.recipe-item.checked .recipe-checkbox {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.recipe-item.checked .recipe-checkbox::after {
    content: '✓';
    color: #000;
    font-weight: bold;
}

.recipe-item.checked .recipe-title span,
.recipe-item.checked .recipe-desc {
    text-decoration: line-through;
    opacity: 0.5;
}

.motivation-text {
    font-style: italic;
    color: var(--color-text-dim);
    margin-top: 8px;
    font-size: 0.95rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* MODALS */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--color-border);
}

.modal h3 {
    margin-bottom: 20px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal h3::before {
    content: 'edit';
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-size: 24px;
    color: var(--color-primary);
}