@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap');

:root {
    color-scheme: only light;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --primary-color: #e81e22;
    --text-color: #333;
    --text-light: #777;
    --border-color: #e0e0e0;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 1rem;
    color: var(--text-color);
}

.dashboard {
    max-width: 600px;
    margin: 0 auto;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.warm-status-detail {
    margin: 0 auto 1.5rem;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.warm-status-detail .row {
    /* Grid (not flex) so the 우주/일반 columns line up across every row regardless of how
       long each row's time text is - flex with a gap let the value-group as a whole shift
       left/right per row since its total width varied with the text length. */
    display: grid;
    grid-template-columns: calc(3.8em + 5ch) 2.3em minmax(0, 1fr) 2.3em minmax(0, 1fr);
    align-items: baseline;
    column-gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-color);
}

.warm-status-detail .row:last-child {
    border-bottom: none;
}

.warm-status-detail .label {
    color: var(--text-color);
    font-weight: 500;
    /* Column is deliberately wider than 나/어머니/아버지 need, with the name centered in
       it - that's what creates the extra breathing room before the 우주 column starts,
       rather than a fixed-side gap that would look uneven with names of different length. */
    text-align: center;
}

.warm-status-detail .value-type {
    color: var(--text-light);
    font-size: 0.78rem;
}

.warm-status-detail .value {
    color: var(--text-light);
    font-size: 0.82rem;
    overflow-wrap: break-word;
}

.warm-status-detail .value.fresh {
    color: #2e7d32;
}

.warm-status-detail .value.stale {
    color: #c62828;
    font-weight: 600;
}

.warm-status-detail .value.active {
    color: #1565c0;
    font-weight: 600;
}

.warm-status-detail .value.queued {
    color: #ef6c00;
    font-weight: 600;
}

.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.barcode-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.barcode-container {
    text-align: center;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Barcode contrast is functional, not decorative. Samsung Force Dark can ignore the
       document opt-out and compress white/black to roughly 74/38. This post-compositing
       correction maps those measured values back near 255/0 and is a no-op for pure 255/0. */
    color-scheme: only light;
    forced-color-adjust: none;
    background-color: #ffffff !important;
    color: #000000 !important;
    filter: brightness(2.4) contrast(3) !important;
    -webkit-filter: brightness(2.4) contrast(3) !important;
    border-radius: 8px;
    border: 1px dashed var(--border-color);
    position: relative;
}

.barcode-container img {
    max-width: 100%;
    height: auto;
    color-scheme: only light;
    forced-color-adjust: none;
    background-color: #ffffff !important;
    filter: none !important;
    -webkit-filter: none !important;
    mix-blend-mode: normal;
    opacity: 1;
}

.barcode-container img:not(.hidden) {
    display: block;
}

.barcode-placeholder {
    color: var(--text-light);
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    position: absolute;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.card-footer {
    margin-top: 1rem;
    text-align: center;
}

.timer {
    font-size: 1.2rem;
    font-weight: 500;
    color: #1e88e5;
}

.status {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

.status.active-refresh {
    color: var(--primary-color);
    font-weight: 700;
}

.benefit-box {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    background-color: #fff7f7;
    border: 1px solid #f5d6d7;
}

.benefit-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.45rem;
}

.benefit-box ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.benefit-box li {
    position: relative;
    padding-left: 0.9rem;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-color);
}

.benefit-box li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.72em;
    width: 0.35rem;
    height: 0.35rem;
    border-radius: 50%;
    background-color: var(--primary-color);
}

.btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: #c01215;
}

.btn.secondary {
    background-color: #f5f5f5;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn.secondary:hover {
    background-color: #eeeeee;
}

.btn.active {
    background-color: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}

.btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

.links-card {
    text-align: center;
}

.links-card h3 {
    margin-bottom: 1rem;
}

.links-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.links-container a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    background-color: #fdebec;
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.hidden {
    display: none;
}

/* Samsung Internet can respect this authored theme instead of force-darkening the light
   page heuristically. This preserves the dark UI while the barcode subtree stays only-light. */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #101116;
        --card-bg: #1f1f1f;
        --primary-color: #ff7479;
        --text-color: #f1f1f1;
        --text-light: #b7b7b7;
        --border-color: #555555;
    }

    .warm-status-detail {
        background-color: var(--card-bg);
    }

    .warm-status-detail .value.fresh {
        color: #81c784;
    }

    .warm-status-detail .value.stale {
        color: #ff8a80;
    }

    .warm-status-detail .value.active,
    .timer {
        color: #64b5f6;
    }

    .warm-status-detail .value.queued {
        color: #ffb74d;
    }

    .benefit-box {
        background-color: #241b1c;
        border-color: #684547;
    }

    .btn.secondary {
        background-color: #505050;
        color: #f1f1f1;
    }

    .btn.secondary:hover {
        background-color: #5c5c5c;
    }

    .links-container a {
        background-color: #3a2224;
    }
}
