/* ════════════════════════════════════════════════════
   Azure Cost Dashboard — style.css
   대시보드 + 로그인/로그아웃 공통 스타일
   ════════════════════════════════════════════════════ */

/* ── 1. CSS 변수 ───────────────────────────────────── */
:root {
    --primary-color: #0078D4;
    --bg-color:      #0d1117;
    --card-bg:       #161b22;
    --text-main:     #e6edf3;
    --text-muted:    #8b949e;
    --border-color:  #30363d;

    /* 레거시 호환 */
    --primary: #0078D4;
    --bg:      #f3f2f1;
    --card:    #ffffff;
    --text:    #323130;
}

/* ── 2. 전체 기본 스타일 ───────────────────────────── */
* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
}

/* ── 3. 대시보드 레이아웃 ─────────────────────────── */
.dashboard-container { max-width: 1400px; margin: auto; }

.kpi-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.canvas-wrapper { position: relative; height: 300px; }

/* ── 4. 카드 공통 ─────────────────────────────────── */
.kpi-card, .chart-card, .rg-control-bar {
    background-color: var(--card-bg) !important;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-radius: 8px;
}

.kpi-card {
    padding: 20px;
    border-top: 4px solid var(--primary-color);
}

.kpi-card h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--text-muted);
}

.kpi-card h2 { margin: 0; font-size: 24px; }

.chart-card { padding: 20px; }

.chart-card h3 {
    display: block !important;
    margin-top: 5px !important;
    padding-bottom: 18px !important;
    margin-bottom: 15px !important;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color) !important;
    text-align: left;
}

/* ── 5. 탭 ────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.tab-btn {
    background: transparent;
    border: none;
    font-size: 16px;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.2s;
}

.tab-btn:hover  { background: rgba(255, 255, 255, 0.05); }
.tab-btn.active { color: var(--primary-color); background: rgba(0, 120, 212, 0.15); }

.tab-content        { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s; }

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

/* ── 6. 리소스 그룹 컨트롤 바 ────────────────────── */
.rg-control-bar {
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.rg-control-bar select {
    background-color: var(--bg-color);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 4px;
    outline: none;
    min-width: 300px;
}

.rg-control-bar select:focus { border-color: var(--primary-color); }

/* ── 7. 전체 구독 카드 ───────────────────────────── */
.sub-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 70px;
}

.sub-card:hover {
    border-color: #58a6ff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(88, 166, 255, 0.15);
}

.sub-card .sub-name {
    font-size: 13px;
    font-weight: 700;
    color: #e6edf3;
    line-height: 1.4;
    word-break: break-all;
    letter-spacing: 0.01em;
}

.sub-card .sub-cost {
    font-size: 20px;
    font-weight: 700;
    color: #58a6ff;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.sub-card .sub-cost.zero {
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 400;
}

/* ── 8. 커스텀 검색 드롭다운 ─────────────────────── */
.custom-select-wrapper {
    position: relative;
    min-width: 380px;
}

.custom-select-input {
    width: 100%;
    padding: 10px 36px 10px 15px;
    border-radius: 6px;
    background: #21262d;
    color: #e6edf3;
    border: 1px solid #30363d;
    font-size: 14px;
    cursor: pointer;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.custom-select-input:focus,
.custom-select-input.open { border-color: #58a6ff; }
.custom-select-input.searching { cursor: text; }

.custom-select-wrapper::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #8b949e;
    pointer-events: none;
    transition: transform 0.2s;
}

.custom-select-wrapper.open::after {
    transform: translateY(-50%) rotate(180deg);
}

.custom-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 9999;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.custom-select-dropdown.open { display: block; }

.custom-select-dropdown li {
    padding: 9px 15px;
    font-size: 14px;
    color: #e6edf3;
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-select-dropdown li:hover,
.custom-select-dropdown li.highlighted {
    background: rgba(88, 166, 255, 0.12);
    color: #58a6ff;
}

.custom-select-dropdown li.no-result {
    color: #8b949e;
    cursor: default;
    font-style: italic;
}

.custom-select-dropdown li.no-result:hover {
    background: transparent;
    color: #8b949e;
}

input[type="date"] { color-scheme: dark; }

/* ── 9. 로그인 / 로그아웃 공통 ───────────────────── */
.auth-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-logo   { font-size: 36px; margin-bottom: 12px; }

.auth-title  {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.auth-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 32px;
    line-height: 1.6;
}

.auth-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 24px 0;
}

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 20px;
    border-radius: 8px;
    background: transparent;
    color: var(--text-main);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.auth-btn:hover  { background: rgba(255,255,255,0.05); border-color: #58a6ff; }
.auth-btn:active { background: rgba(255,255,255,0.08); }

.auth-notice {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

.auth-notice a { color: #58a6ff; text-decoration: none; }

.auth-error {
    display: none;
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.4);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #ff7b72;
    text-align: left;
}

.auth-countdown {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 16px;
}

.auth-countdown span { color: #58a6ff; font-weight: 600; }