@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css");

:root {
    --w-blue-500: #3366FF;
    --w-blue-600: #1B51F5;
    --w-blue-100: #EBF0FF;
    
    --w-gray-900: #17171C;
    --w-gray-700: #4A4A5A;
    --w-gray-600: #707080;
    --w-gray-500: #8E8E9F;
    --w-gray-400: #B5B5C6;
    --w-gray-200: #E5E5EC;
    --w-gray-100: #F4F4F8;
    --w-gray-55:  #F8F9FA;
    --w-gray-50:  #F9F9FB;

    --w-red-500:   #FF334B;
    --w-red-100:   #FFEBEB;
    --w-orange-500: #FF9500;
    --w-orange-100: #FFF4E5;
    --w-green-500: #00B368;
    --w-green-100: #E6F7F0;
    
    --font-sans: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
    position: fixed; /* 뷰포트 스크롤 전면 차단 */
    top: 0;
    left: 0;
    overscroll-behavior: none; /* 크롬 새로고침 방지 및 탄성 스크롤 잠금 */
}

body {
    font-family: var(--font-sans);
    background-color: #eef0f3;
    color: var(--w-gray-900);
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
}

/* Mobile Container */
.app-container {
    width: 100%;
    max-width: 450px;
    height: 100dvh; /* 모바일 크롬 주소창 높이에 맞춘 동적 뷰포트 높이 */
    background-color: var(--w-gray-50);
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    overscroll-behavior: none;
}

@media (min-width: 451px) {
    .app-container {
        height: 100%;
        max-height: 920px;
        border-radius: 20px; /* 데스크톱 뷰에서는 기기 형태의 디자인 제공 */
    }
}

/* Header */
.app-header {
    background-color: var(--w-gray-50);
    padding: 16px 20px 8px 20px;
    border-bottom: 1px solid var(--w-gray-200);
    flex-shrink: 0;
}

.app-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--w-gray-900);
}

.app-subtitle {
    font-size: 14px;
    color: var(--w-gray-600);
    margin-top: 1px;
}

/* Segmented Control / Tabs */
.tab-nav {
    display: flex;
    background-color: var(--w-gray-100);
    padding: 4px;
    border-radius: 8px;
    margin: 10px 20px;
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    border: none;
    background: none;
    padding: 8px 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--w-gray-600);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    text-decoration: none;
}

.tab-btn.active {
    background-color: #ffffff;
    color: var(--w-blue-500);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
}

/* Main Content Area */
.app-content {
    padding: 0 20px 16px 20px;
    flex: 1;
    overflow-y: hidden; /* Lock scroll to internal panes/lists only */
    display: flex;
    flex-direction: column;
}

.tab-pane {
    display: none;
    flex-direction: column;
    flex: 1;
    height: 100%;
    overflow: hidden;
}

.tab-pane.active {
    display: flex;
}

#tab-routines {
    overflow-y: auto;
}

/* Info Banner */
.info-banner {
    background-color: var(--w-gray-100);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.info-banner-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--w-gray-700);
    margin-bottom: 2px;
}

.info-banner-text {
    font-size: 13px;
    color: var(--w-gray-600);
    line-height: 1.35;
}

/* Cards & Sections */
.section-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--w-gray-700);
    margin: 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card {
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--w-gray-200);
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.01);
}

/* Compact Weekly Routine Card */
.weekly-routine-card {
    padding: 0;
    overflow: hidden;
}

.weekly-routine-row {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--w-gray-100);
    min-height: 44px;
}

.weekly-routine-row:last-child {
    border-bottom: none;
}

.day-label {
    width: 44px;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    padding: 3px 6px;
    border-radius: 6px;
    margin-right: 12px;
    flex-shrink: 0;
}

.day-label.mon { background-color: #EBF0FF; color: var(--w-blue-500); }
.day-label.tue { background-color: #FFF4E5; color: var(--w-orange-500); }
.day-label.wed { background-color: #E6F7F0; color: var(--w-green-500); }
.day-label.thu { background-color: #F4F4F8; color: var(--w-gray-700); }
.day-label.fri { background-color: #FFEBEB; color: var(--w-red-500); }

.routine-tags-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    align-items: center;
}

.routine-tag {
    background-color: var(--w-gray-100);
    color: var(--w-gray-900);
    font-size: 14px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--w-gray-200);
}

.routine-tag .delete-btn {
    border: none;
    background: none;
    color: var(--w-gray-500);
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    line-height: 1;
}

.routine-tag .delete-btn:hover {
    color: var(--w-red-500);
}

/* Scrollable Food List Container */
.scrollable-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 8px;
}

/* Food List Styles */
.food-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--w-gray-100);
}

.food-item:last-child {
    border-bottom: none;
}

.food-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.food-category-badge {
    align-self: flex-start;
    font-size: 12px;
    font-weight: 700;
    background-color: var(--w-gray-100);
    color: var(--w-gray-600);
    padding: 1px 5px;
    border-radius: 4px;
}

.food-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--w-gray-900);
}

.food-dates {
    font-size: 13px;
    color: var(--w-gray-500);
}

.food-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.badge {
    font-size: 12px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.badge-warning { background-color: var(--w-orange-100); color: var(--w-orange-500); }
.badge-danger { background-color: var(--w-red-100); color: var(--w-red-500); }
.badge-safe { background-color: var(--w-green-100); color: var(--w-green-500); }
.badge-none { background-color: var(--w-gray-100); color: var(--w-gray-500); }

.delete-food-btn {
    background: none;
    border: none;
    color: var(--w-gray-500);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.15s;
}

.delete-food-btn:hover {
    color: var(--w-red-500);
}

/* Add Button (Floating-like / Bottom Sticky) */
.action-trigger-btn {
    background-color: var(--w-blue-500);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    height: 44px;
    font-size: 15px;
    font-weight: 700;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    width: 100%;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(51, 102, 255, 0.2);
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.action-trigger-btn:hover {
    background-color: var(--w-blue-600);
}

/* Bottom Sheet Modal */
.bottom-sheet-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(23, 23, 28, 0.4);
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
}

.bottom-sheet-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.bottom-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
    z-index: 600;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    padding: 16px 20px 24px 20px;
}

.bottom-sheet.show {
    transform: translateY(0);
}

/* Bottom Sheet Top Handle */
.bottom-sheet-handle {
    width: 36px;
    height: 4px;
    background-color: var(--w-gray-200);
    border-radius: 2px;
    margin: 0 auto 16px auto;
}

.bottom-sheet-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--w-gray-900);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bottom-sheet-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--w-gray-500);
    cursor: pointer;
    font-weight: bold;
}

/* Forms inside Sheet */
.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--w-gray-700);
    margin-bottom: 3px;
}

.input-control {
    width: 100%;
    height: 38px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--w-gray-200);
    font-family: var(--font-sans);
    font-size: 15px;
    background-color: var(--w-gray-50);
    transition: all 0.15s;
    outline: none;
}

.input-control:focus {
    border-color: var(--w-blue-500);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px var(--w-blue-100);
}

.row-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-primary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 40px;
    background-color: var(--w-blue-500);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s;
    margin-top: 6px;
}

.btn-primary:hover {
    background-color: var(--w-blue-600);
}

/* Toast Container */
.toast-container {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: calc(100% - 40px);
}

.toast {
    background-color: var(--w-gray-900);
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.toast.toast-error { border-left: 3px solid var(--w-red-500); }
.toast.toast-success { border-left: 3px solid var(--w-green-500); }
.empty-text { font-size: 13px; color: var(--w-gray-500); font-style: italic; }
