/* ============================================
   METIX Todo — Daily Schedule Web UI
   Dark theme matching iOS Theme.swift
   ============================================ */

:root {
    --bg: #1A1A2E;
    --card: #16213E;
    --accent: #0F3460;
    --highlight: #E94560;
    --text: #EAEAEA;
    --text2: #8892A0;
    --blue: #4A90D9;
    --green: #22c55e;
    --orange: #f97316;
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ============================================
   HEADER
   ============================================ */

#header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--card);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

#header-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

#header-date {
    font-size: 0.85rem;
    color: var(--text2);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text2);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.btn-icon:hover { background: rgba(255,255,255,0.06); }
.btn-icon:active { background: rgba(255,255,255,0.1); }

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--blue); color: white; }
.btn-secondary { background: var(--accent); color: var(--text); }
.btn-small { padding: 5px 14px; font-size: 0.75rem; }
.btn-large { padding: 14px 24px; font-size: 1rem; width: 100%; border-radius: 12px; }

.btn-success { background: var(--green); color: white; }
.btn-not-done { background: rgba(249,115,22,0.15); color: var(--orange); }
.btn-postpone { background: var(--orange); color: white; }
.btn-postpone.btn-disabled { opacity: 0.4; pointer-events: none; }
.btn-move-on { background: rgba(136,146,160,0.15); color: var(--text2); }
.btn-ghost { background: none; border: 1px solid rgba(255,255,255,0.1); color: var(--text2); }

/* ============================================
   MAIN CONTENT
   ============================================ */

#main-content {
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* ============================================
   LOADING / EMPTY / ERROR
   ============================================ */

.loading {
    text-align: center;
    padding: 80px 24px;
    color: var(--text2);
    font-size: 0.9rem;
}

.empty-state {
    text-align: center;
    padding: 100px 24px 80px;
}

.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    opacity: 0.8;
}

.empty-state h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text2);
    font-size: 0.9rem;
}

/* ============================================
   SCHEDULE HEADER (Draft)
   ============================================ */

.schedule-header {
    text-align: center;
    padding: 28px 24px 20px;
}

.schedule-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.schedule-meta {
    display: flex;
    gap: 16px;
    justify-content: center;
    color: var(--text2);
    font-size: 0.85rem;
    margin: 6px 0 16px;
}

.btn-start-day {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--blue);
    color: white;
    padding: 12px 28px;
    border-radius: 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.btn-start-day:active { transform: scale(0.97); }

/* ============================================
   ACTIVE BLOCK CARD
   ============================================ */

.active-block-card {
    text-align: center;
    padding: 24px 20px;
    background: var(--card);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.active-block-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
}

.active-block-timer {
    font-size: 3.2rem;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    color: var(--blue);
    margin: 12px 0;
    letter-spacing: -0.02em;
}

.timer-expired {
    color: var(--highlight) !important;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.active-block-meta {
    color: var(--text2);
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.active-block-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-done {
    background: rgba(34,197,94,0.15);
    color: var(--green);
    border: none;
    padding: 10px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.btn-done:active { background: rgba(34,197,94,0.25); }

.btn-extend {
    background: rgba(74,144,217,0.15);
    color: var(--blue);
    border: none;
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.btn-extend:active { background: rgba(74,144,217,0.25); }

.btn-pause {
    background: rgba(234,179,8,0.15);
    color: #eab308;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.btn-pause:active { background: rgba(234,179,8,0.25); }

.btn-resume {
    background: var(--blue);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.btn-resume:active { background: #3a7bc8; }

.btn-resume-block {
    background: var(--blue);
    color: white;
    border: none;
    padding: 5px 14px;
    border-radius: 14px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-resume-block:active { transform: scale(0.95); }

/* Paused active block */
.active-block-paused {
    border-bottom: 2px solid rgba(234,179,8,0.3);
}

.active-block-paused .active-block-timer {
    color: #eab308;
}

.paused-badge {
    display: inline-block;
    background: rgba(234,179,8,0.15);
    color: #eab308;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.timer-paused {
    opacity: 0.6;
}

/* Paused timeline card */
.card-paused {
    background: rgba(234,179,8,0.06);
    border: 1px solid rgba(234,179,8,0.15);
}

.badge-paused { color: #eab308; }

/* ============================================
   TIMELINE
   ============================================ */

.timeline {
    padding: 16px 20px;
}

.block-row {
    display: flex;
    gap: 12px;
}

.block-timeline {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 14px;
    flex-shrink: 0;
    padding-top: 4px;
}

.timeline-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.dot-num {
    font-size: 0.6rem;
    font-weight: 700;
    color: white;
}

.pin-icon {
    font-size: 0.7rem;
    margin-right: 3px;
}

.timeline-line {
    flex: 1;
    width: 2px;
    background: rgba(136,146,160,0.15);
    margin: 4px 0;
    min-height: 8px;
}

.block-row:last-child .timeline-line {
    visibility: hidden;
}

.block-card {
    flex: 1;
    background: var(--card);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 6px;
    transition: background 0.15s;
}

.card-active {
    background: rgba(74,144,217,0.08);
    border: 1px solid rgba(74,144,217,0.2);
}

.block-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.block-title {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    flex: 1;
}

.block-duration {
    font-size: 0.8rem;
    color: var(--text2);
    white-space: nowrap;
    flex-shrink: 0;
}

.block-time {
    font-size: 0.75rem;
    color: var(--text2);
    margin-top: 2px;
}

.block-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.badge {
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-active { color: var(--blue); }
.badge-done { color: var(--green); }
.badge-skipped { color: var(--orange); }

.btn-start-block {
    background: var(--blue);
    color: white;
    border: none;
    padding: 5px 14px;
    border-radius: 14px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-start-block:active { transform: scale(0.95); }

.btn-skip-block {
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.btn-skip-block:hover { background: rgba(255,255,255,0.06); }

/* ============================================
   MODAL (Bottom Sheet)
   ============================================ */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.15s ease-out;
}

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

.modal-content {
    background: var(--card);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-transition {
    padding: 28px 24px;
    padding-bottom: max(28px, env(safe-area-inset-bottom));
}

/* ============================================
   TRANSITION STEPS
   ============================================ */

.transition-step {
    text-align: center;
}

.transition-step h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 8px 0;
    line-height: 1.4;
}

.transition-icon {
    font-size: 2.8rem;
    margin-bottom: 4px;
}

.done-icon { color: var(--green); }

.text-muted {
    color: var(--text2);
    font-size: 0.85rem;
}

.transition-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.extend-row {
    display: flex;
    gap: 10px;
}

.btn-extend-modal {
    flex: 1;
    background: rgba(74,144,217,0.12);
    color: var(--blue);
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-extend-modal:active { background: rgba(74,144,217,0.22); }

/* Blocker grid */
.blocker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 16px 0;
}

.blocker-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: var(--bg);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    cursor: pointer;
    color: var(--text);
    font-size: 0.8rem;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.blocker-btn:active { transform: scale(0.97); }

.blocker-btn .blocker-icon {
    font-size: 1.4rem;
}

.blocker-btn.selected {
    background: rgba(249,115,22,0.15);
    border-color: var(--orange);
    color: var(--orange);
}

.blocker-note-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    margin-bottom: 4px;
    transition: border-color 0.15s;
}

.blocker-note-input:focus {
    border-color: rgba(255,255,255,0.2);
}

.blocker-note-input::placeholder {
    color: var(--text2);
}

/* Next/Suggestion step */
.next-block-preview {
    background: var(--bg);
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    text-align: left;
}

.next-block-preview .next-label {
    font-size: 0.75rem;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.next-block-preview h4 {
    font-size: 1rem;
    font-weight: 600;
}

.next-block-preview .next-meta {
    font-size: 0.8rem;
    color: var(--text2);
    margin-top: 4px;
}

.suggestion-icon {
    font-size: 2.2rem;
    margin-bottom: 4px;
}

.ctx-tag {
    display: inline-block;
    padding: 2px 10px;
    background: rgba(74,144,217,0.12);
    color: var(--blue);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 2px;
}

.next-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.next-actions .btn {
    flex: 1;
}

/* ============================================
   SUMMARY VIEW
   ============================================ */

.summary-view {
    padding: 24px 20px;
}

.progress-ring-container {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 16px auto 24px;
}

.progress-ring {
    width: 100%;
    height: 100%;
}

.progress-fill {
    transition: stroke-dashoffset 0.8s ease-in-out;
}

.progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.progress-count {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.progress-label {
    font-size: 0.8rem;
    color: var(--text2);
    margin-top: 2px;
}

.summary-stats {
    display: flex;
    gap: 28px;
    justify-content: center;
    margin-bottom: 24px;
}

.stat { text-align: center; }

.stat-value {
    font-size: 1.2rem;
    font-weight: 600;
    display: block;
}

.stat-blue { color: var(--blue); }
.stat-orange { color: var(--orange); }

.stat-label {
    font-size: 0.8rem;
    color: var(--text2);
    margin-top: 2px;
}

.summary-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.summary-card h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

.summary-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
}

.summary-icon {
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.summary-title {
    flex: 1;
    font-size: 0.88rem;
    line-height: 1.4;
}

.summary-dur {
    font-size: 0.8rem;
    color: var(--text2);
    flex-shrink: 0;
}

.blocker-count {
    color: var(--orange);
    font-weight: 600;
}

.summary-note {
    font-size: 0.8rem;
    color: var(--text2);
    font-style: italic;
    margin-left: 32px;
    margin-top: 2px;
}
