/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.header {
    background: #fff;
    border-bottom: 1px solid #e5e5ea;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
}
.header-inner {
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #007AFF, #5856d6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.logo-text {
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
}

/* ── Main ── */
.main {
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px 48px;
    flex: 1;
}

/* ── Welcome ── */
.welcome { margin-bottom: 28px; }
.welcome h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1d1d1f;
    letter-spacing: -0.5px;
}
.welcome-sub {
    font-size: 15px;
    color: #86868b;
    margin-top: 4px;
}

/* ── Card ── */
.card {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* ── Section Header ── */
.section-title {
    font-size: 17px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 20px;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.section-header .section-title { margin-bottom: 0; }
.attendance-badge {
    font-size: 13px;
    font-weight: 600;
    color: #34c759;
    background: #e8f8ee;
    padding: 4px 12px;
    border-radius: 20px;
}

/* ── Progress Bar ── */
.progress-container {
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}
.progress-track {
    display: flex;
    min-width: 700px;
    position: relative;
}

/* Lines layer — absolute behind all dots */
.progress-lines {
    position: absolute;
    top: 32px;
    left: 0;
    right: 0;
    display: flex;
    z-index: 0;
    /* Each step is 10% wide; lines run between dot centers (5% to 95%) */
    padding: 0 5%;
}
.progress-line-segment {
    flex: 1;
    height: 3px;
    background: #e5e5ea;
    transition: background 0.6s ease;
}
.progress-line-segment.completed {
    background: #34c759;
}
.progress-line-segment.current {
    background: linear-gradient(to right, #34c759, #007AFF);
}

.progress-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-top: 18px;
    z-index: 1;
}

/* Dot */
.step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5e5ea;
    border: 3px solid #e5e5ea;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s ease;
}
.step-dot svg {
    width: 14px;
    height: 14px;
    display: block;
    flex-shrink: 0;
}
.progress-step.completed .step-dot {
    background: #34c759;
    border-color: #34c759;
}
.progress-step.current .step-dot {
    background: #007AFF;
    border-color: #007AFF;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
    animation: pulse 2s ease-in-out infinite;
}
.progress-step.upcoming .step-dot {
    background: #fff;
    border-color: #d2d2d7;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2); }
    50% { box-shadow: 0 0 0 8px rgba(0, 122, 255, 0.08); }
}

/* Labels */
.step-label {
    font-size: 11px;
    font-weight: 600;
    color: #86868b;
    text-align: center;
    margin-top: 10px;
    line-height: 1.3;
    max-width: 80px;
    transition: color 0.4s ease;
}
.progress-step.completed .step-label { color: #1d1d1f; }
.progress-step.current .step-label {
    color: #007AFF;
    font-weight: 700;
}

.step-date {
    font-size: 10px;
    color: #86868b;
    margin-top: 3px;
}

/* ── Appointment List ── */
.apt-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.apt-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 10px;
    transition: background 0.15s ease;
}
.apt-row:hover { background: #f9f9fb; }
.apt-row.canceled { opacity: 0.5; }
.apt-row.canceled .apt-name { text-decoration: line-through; }

.apt-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.apt-name {
    font-size: 14px;
    font-weight: 500;
    color: #1d1d1f;
}
.apt-date {
    font-size: 12px;
    color: #86868b;
}

/* Status Badges */
.apt-status-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 16px;
    white-space: nowrap;
}
.apt-icon {
    width: 14px;
    height: 14px;
}
.apt-status-badge.attended {
    color: #15803d;
    background: #dcfce7;
}
.apt-status-badge.no_show {
    color: #991b1b;
    background: #fee2e2;
}
.apt-status-badge.upcoming {
    color: #1d4ed8;
    background: #dbeafe;
}
.apt-status-badge.canceled {
    color: #6b7280;
    background: #f3f4f6;
}

/* ── Error Card ── */
.error-card {
    text-align: center;
    padding: 48px 24px;
    max-width: 480px;
    margin: 60px auto;
}
.error-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fee2e2;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    margin: 0 auto 16px;
}
.error-text {
    font-size: 15px;
    color: #6b7280;
    line-height: 1.5;
}

/* ── Footer ── */
.footer {
    text-align: center;
    padding: 20px 24px;
    font-size: 12px;
    color: #86868b;
}

/* ── Animation (loaded state) ── */
.progress-step { opacity: 0; transform: translateY(8px); }
.progress-step.loaded { opacity: 1; transform: translateY(0); transition: opacity 0.4s ease, transform 0.4s ease; }

/* ── Tooltip ── */
.step-tooltip {
    position: absolute;
    background: #1d1d1f;
    color: #fff;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    pointer-events: none;
    z-index: 100;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 200px;
    white-space: nowrap;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .main { padding: 20px 16px 40px; }
    .welcome h1 { font-size: 22px; }
    .card { padding: 18px 16px; border-radius: 12px; }
    .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .apt-row { padding: 12px; }
    .apt-name { font-size: 13px; }
    .step-label { font-size: 10px; max-width: 65px; }
}
