* { box-sizing: border-box; }

:root {
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-main: #1d1d1f;
    --text-sub: #86868b;
    --primary: #0071e3;
    --primary-hover: #0077ed;
    --primary-soft: rgba(0, 113, 227, 0.08);
    --border: #d2d2d7;
    --success: #34c759;
    --error: #ff3b30;
    --warning: #ff9500;
    --radius: 4px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
    --bg-color: #000000;
    --card-bg: #1c1c1e;
    --text-main: #f5f5f7;
    --text-sub: #a1a1a6;
    --border: #333333;
    --primary-soft: rgba(10, 132, 255, 0.15);
    color-scheme: dark;
}

/* select arrow fix */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2386868b' d='M5 0L0 4h10L5 0zM5 10L0 6h10l-5 4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 32px !important;
}

[data-theme="dark"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23f5f5f7' d='M5 0L0 4h10L5 0zM5 10L0 6h10l-5 4z'/%3E%3C/svg%3E");
}

/* Ensure other inputs don't have arrows */
input[type="password"], input[type="text"] {
    background-image: none !important;
}

/* Date Picker Icon Fix - PC & Mobile 모두 아이콘 강제 표시 */
input[type="date"] {
    position: relative;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 20px !important;
    appearance: none;
    -webkit-appearance: none;
}

[data-theme="dark"] input[type="date"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") !important;
}

/* Hide default indicator but keep it clickable across all browsers */
input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    left: 0; top: 0; width: 100%; height: 100%;
    margin: 0; padding: 0; cursor: pointer;
    opacity: 0;
}

/* Tooltip styles */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    margin-left: 4px;
    color: var(--text-sub);
    font-size: 0.8rem;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: var(--text-main);
    color: var(--card-bg);
    text-align: center;
    border-radius: 4px;
    padding: 8px;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-weight: normal;
    font-size: 0.75rem;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

body { 
    font-family: 'Pretendard', -apple-system, sans-serif; 
    margin: 0; padding: 0; 
    color: var(--text-main); 
    background-color: var(--bg-color); 
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-layout { display: flex; min-height: 100vh; }

.app-sidebar {
    width: 280px; background: var(--card-bg); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 1000;
}
.sidebar-header { padding: 30px 24px; display: flex; justify-content: space-between; align-items: center; }
.sidebar-title { font-size: 1.4rem; font-weight: 800; margin: 0; letter-spacing: -0.5px; }
.side-nav { padding: 0 16px 24px; flex: 1; overflow-y: auto; }

.nav-group { margin-bottom: 8px; }
.nav-category {
    width: 100%; text-align: left; padding: 12px 16px; background: none; border: none; font-weight: 700;
    color: var(--text-main); cursor: pointer; border-radius: 4px; transition: all 0.2s;
    font-size: 0.95rem; display: flex; align-items: center; gap: 10px;
}
.nav-category:hover { background: var(--bg-color); }

.sub-menu { padding-left: 8px; display: none; flex-direction: column; gap: 4px; margin-top: 4px; }
.sub-menu.active { display: flex; }
.sub-item {
    text-align: left; padding: 10px 36px; background: none; border: none;
    color: var(--text-sub); cursor: pointer; border-radius: 4px; font-size: 0.88rem; transition: all 0.2s;
}
.sub-item:hover { color: var(--text-main); background: var(--bg-color); }
.sub-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }

.app-content { flex: 1; padding: 40px 60px; max-width: 1200px; width: 100%; box-sizing: border-box; }
.content-title { font-size: 2rem; font-weight: 800; margin: 0 0 32px 0; color: var(--text-main); letter-spacing: -0.8px; }

.card { background: var(--card-bg); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); margin-bottom: 24px; border: 1px solid var(--border); }

.primary-btn, .secondary-btn, .reset-btn, .share-btn {
    padding: 12px 24px; border: none; border-radius: 4px; font-weight: 700; 
    cursor: pointer; transition: all 0.2s; font-size: 0.95rem;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.primary-btn { background: var(--primary); color: white; }
.secondary-btn { background: var(--bg-color); color: var(--text-main); border: 1px solid var(--border); }

.reset-btn { 
    width: 100%; 
    background: #ffffff; 
    color: #ff3b30; 
    border: 1.5px solid #ff3b30;
    box-shadow: 0 2px 4px rgba(255, 59, 48, 0.1);
}
.reset-btn:hover {
    background: #fff1f0;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 59, 48, 0.15);
}
[data-theme="dark"] .reset-btn { 
    background: #1c1c1e; 
    color: #ff453a;
    border-color: #ff453a;
}

.share-btn { background: var(--primary-soft); color: var(--primary); font-size: 0.85rem; padding: 8px 16px; border-radius: 20px; }

/* Input & Select Unified Style */
.input-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.input-field { display: flex; flex-direction: column; gap: 10px; }
.input-field label { font-size: 0.85rem; font-weight: 700; color: var(--text-sub); margin-left: 4px; }

.select-row { display: flex !important; flex-direction: row !important; gap: 8px; width: 100%; }
.select-row select { flex: 1; min-width: 0; height: 50px; }

select, input[type="date"], input[type="password"], input[type="text"] {
    height: 50px; 
    padding: 0 16px; 
    border-radius: 4px; 
    border: 1px solid var(--border); 
    background-color: var(--card-bg); 
    color: var(--text-main); 
    font-weight: 400; 
    font-size: 0.95rem; 
    width: 100%; 
    box-sizing: border-box; 
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    line-height: normal;
}

/* Date Input & Checkbox Row */
.separation-row {
    display: flex;
    gap: 16px;
    align-items: center;
    width: 100%;
}

.date-input-wrapper {
    flex: 1;
    min-width: 0;
}

.disabled-check-wrapper {
    flex: 0 0 auto;
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    white-space: nowrap;
    padding: 0 16px;
    border: 1px solid var(--border);
    height: 50px;
    border-radius: 4px;
    background: var(--card-bg);
    flex-shrink: 0;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
    margin: 0;
}

.disabled-check-wrapper label {
    margin: 0 !important;
    cursor: pointer;
    font-size: 0.95rem !important;
    color: var(--text-main) !important;
    font-weight: 600 !important;
}

@media (max-width: 768px) {
    .separation-row {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 12px;
    }
    .date-input-wrapper {
        flex: 0 0 140px;
        min-width: 135px;
    }
    .disabled-check-wrapper {
        flex: 1;
        min-width: 100px;
        height: 46px;
        padding: 0 8px;
        justify-content: center;
    }
}

.txt-important { color: var(--error); font-weight: 800; }
.txt-highlight { color: var(--primary); font-weight: 800; }
.txt-bold { font-weight: 700; color: var(--text-main); }

.mobile-header { 
    display: none; 
    position: fixed; top: 0; left: 0; right: 0; 
    height: 60px; background: var(--card-bg); 
    border-bottom: 1px solid var(--border); 
    align-items: center; padding: 0 16px; 
    z-index: 1001; 
}
.icon-btn, .theme-btn { 
    height: 40px; 
    min-width: 40px;
    background: var(--bg-color); 
    border: 1px solid var(--border); 
    padding: 0 12px; border-radius: 4px; 
    font-size: 0.9rem; cursor: pointer; color: var(--text-main); 
    font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.mobile-title { 
    position: absolute; left: 50%; transform: translateX(-50%);
    font-size: 1.25rem; margin: 0; font-weight: 800; 
    color: var(--text-main); letter-spacing: -0.5px; white-space: nowrap;
}
#theme-toggle-mob { margin-left: auto; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; }

@media (max-width: 768px) {
    .app-sidebar { position: fixed; left: -280px; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
    .app-sidebar.open { transform: translateX(280px); }
    .mobile-header { display: flex; }
    .app-content { margin-top: 60px; padding: 20px 12px; }
    .card { padding: 20px 16px; }
    .sidebar-overlay.open { display: block; }
    
    select, input[type="date"], input[type="password"] { 
        height: 46px; padding: 0 12px; font-size: 0.95rem; 
    }
    .select-row select { height: 46px; }
    .input-grid { gap: 16px; }
}

.theme-btn { 
    background: var(--bg-color); border: 1px solid var(--border); width: 40px; height: 40px; 
    border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
