/* ═══════════════════════════════════════════════════════
   convert.cosmure.com — UI Design System
   review.cosmure.com Design System v1.1과 정렬
   Key color: #0D8AC7 (Cosmure deep blue)
   Pretendard Variable self-hosted (../fonts/)
   ═══════════════════════════════════════════════════════ */

@import url('../fonts/pretendard-variable.css');

:root {
    /* === Brand color system === */
    --primary:       #0D8AC7;
    --primary-hover: #0976AD;
    --primary-light: #2BA0DC;
    --primary-dark:  #064E73;
    --primary-bg:    #E7F6FD;
    --primary-bg-2:  #D1EEFB;

    /* === Neutral palette === */
    --heading:       #111827;
    --body:          #6B7280;
    --caption:       #9CA3AF;
    --border:        #E5E7EB;
    --bg:            #F9FAFB;
    --card-bg:       #FFFFFF;
    --row-stripe:    #F9FAFB;

    /* === Status colors (5 levels — review system) === */
    --safe-bg:       #ECFDF5; --safe-text:        #047857;
    --allowed-bg:    #EFF6FF; --allowed-text:     #1D4ED8;
    --caution-bg:    #FFFBEB; --caution-text:     #B45309;
    --restricted-bg: #FFF7ED; --restricted-text:  #C2410C;
    --banned-bg:     #FEF2F2; --banned-text:      #B91C1C;

    /* === Spacing & radius === */
    --radius-sm: 6px;
    --radius:    8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(17,24,39,.04);
    --shadow:    0 1px 3px rgba(17,24,39,.06), 0 1px 2px rgba(17,24,39,.04);
    --shadow-md: 0 4px 12px rgba(17,24,39,.08);

    /* === Fonts === */
    --font: 'Pretendard Variable', 'Pretendard', 'Noto Sans KR',
            -apple-system, BlinkMacSystemFont, 'Malgun Gothic',
            'Apple SD Gothic Neo', sans-serif;
    --font-mono: 'Consolas', 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--heading);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Typography Scale ─── */
h1 { font-size: 28px; font-weight: 700; color: var(--heading); line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 22px; font-weight: 700; color: var(--heading); line-height: 1.25; letter-spacing: -0.01em; }
h3 { font-size: 18px; font-weight: 600; color: var(--heading); line-height: 1.3; }
h4 { font-size: 15px; font-weight: 600; color: var(--heading); line-height: 1.4; }
h5 { font-size: 13px; font-weight: 400; color: var(--body); line-height: 1.5; }
h6 { font-size: 11px; font-weight: 400; color: var(--caption); line-height: 1.5; }

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-hover); }

code {
    font-family: var(--font-mono);
    font-size: 0.92em;
    background: var(--primary-bg);
    color: var(--primary-hover);
    padding: 1px 6px;
    border-radius: 3px;
}

/* ─── Top Bar ─── */
.top-bar {
    background: var(--primary);
    color: #fff;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(13,138,199,.15);
}
.top-bar-left { display: flex; align-items: center; gap: 16px; }
.top-bar-right { display: flex; align-items: center; gap: 12px; }

.brand {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 3px;
    color: #fff;
    text-decoration: none;
}
.brand:hover { color: #fff; }
.brand-sub { font-weight: 400; font-size: 14px; opacity: .85; margin-left: 4px; letter-spacing: 1.5px; }
.nav-label { font-size: 13px; opacity: .75; }

.user-badge {
    background: rgba(255,255,255,.18);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: #fff;
}

.top-bar a.top-link {
    font-size: 13px;
    color: #fff;
    opacity: .85;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background .15s, opacity .15s;
}
.top-bar a.top-link:hover { opacity: 1; background: rgba(255,255,255,.12); }

.top-bar .btn-outline { color: #fff; border-color: rgba(255,255,255,.4); }
.top-bar .btn-outline:hover { background: rgba(255,255,255,.12); border-color: #fff; color: #fff; }

/* ─── Container ─── */
.container { max-width: 1200px; margin: 24px auto; padding: 0 24px; }

/* ─── Hero ─── */
.hero { margin-bottom: 24px; padding: 8px 4px; }
.hero h1 { margin: 0 0 8px; }
.hero .lead { color: var(--body); font-size: 15px; margin: 0; max-width: 800px; }

/* ─── Cards ─── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s;
}
.card:hover { box-shadow: var(--shadow); }
.card h2 { font-size: 18px; margin-bottom: 8px; }
.card h3 { font-size: 14px; color: var(--body); margin: 16px 0 8px; font-weight: 600; }
.card .desc { color: var(--body); font-size: 14px; margin-bottom: 20px; }

.card-muted { background: var(--bg); border-color: var(--border); }

.hidden { display: none !important; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    text-decoration: none;
    font-family: inherit;
    line-height: 1.2;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 2px 6px rgba(13,138,199,.30);
}
.btn-primary:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--heading);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-ghost {
    background: transparent;
    color: var(--body);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--primary); }
.btn-full { width: 100%; }

/* ─── Form / Dropzone ─── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--body);
    margin-bottom: 6px;
}
input[type="text"], input[type="number"], textarea, select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--heading);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
}
textarea { font-family: var(--font-mono); resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--caption); }
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13,138,199,.15);
}

.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 180px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all .15s;
    color: var(--body);
    margin-bottom: 16px;
    background: var(--bg);
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary-hover);
}
.dropzone svg {
    margin-bottom: 12px;
    opacity: .55;
    color: var(--primary);
}
.dropzone .dz-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.dropzone .dz-hint { font-size: 12px; color: var(--caption); }
.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: 0;
    padding: 0;
}

.file-info {
    padding: 10px 14px;
    background: var(--safe-bg);
    color: var(--safe-text);
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid rgba(4,120,87,.15);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.form-row .btn { flex-shrink: 0; }

.hint {
    margin-top: 14px;
    font-size: 12px;
    color: var(--caption);
    line-height: 1.7;
}
.hint strong { color: var(--body); font-weight: 600; }

/* ─── Alerts ─── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.alert-error   { background: var(--banned-bg);  color: var(--banned-text);  border-color: rgba(185,28,28,.12); }
.alert-success { background: var(--safe-bg);    color: var(--safe-text);    border-color: rgba(4,120,87,.12); }
.alert-info    { background: var(--primary-bg); color: var(--primary-hover);border-color: rgba(13,138,199,.20); }
.alert-warn    { background: var(--caution-bg); color: var(--caution-text);border-color: rgba(180,83,9,.20); }

/* ─── Status badges ─── */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
    text-transform: uppercase;
}
.status-safe       { background: var(--safe-bg);       color: var(--safe-text); }
.status-allowed    { background: var(--allowed-bg);    color: var(--allowed-text); }
.status-caution    { background: var(--caution-bg);    color: var(--caution-text); }
.status-restricted { background: var(--restricted-bg); color: var(--restricted-text); }
.status-banned     { background: var(--banned-bg);     color: var(--banned-text); }

/* ─── Summary Cards (balance / meta) ─── */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.summary-card {
    text-align: center;
    padding: 16px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card-bg);
    transition: transform .15s, box-shadow .15s;
}
.summary-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.summary-card .num {
    font-size: 24px;
    font-weight: 700;
    color: var(--heading);
    line-height: 1.1;
    font-feature-settings: "tnum" 1;
}
.summary-card .label {
    font-size: 12px;
    color: var(--body);
    margin-top: 4px;
    font-weight: 500;
}
.summary-card.safe       { background: var(--safe-bg);       border-color: rgba(4,120,87,.20); }
.summary-card.safe .num  { color: var(--safe-text); }
.summary-card.caution    { background: var(--caution-bg);    border-color: rgba(180,83,9,.20); }
.summary-card.caution .num{color: var(--caution-text); }
.summary-card.banned     { background: var(--banned-bg);     border-color: rgba(185,28,28,.20); }
.summary-card.banned .num{ color: var(--banned-text); }

/* ─── Meta Grid (key-value) ─── */
.meta-grid {
    display: grid;
    grid-template-columns: 110px 1fr;
    row-gap: 8px;
    column-gap: 16px;
    margin: 0 0 16px;
    font-size: 14px;
}
.meta-grid dt { color: var(--body); font-weight: 500; }
.meta-grid dd { margin: 0; color: var(--heading); word-break: break-word; }

/* ─── Result Table (review style) ─── */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.results-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}
.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.result-table th {
    background: var(--primary);
    color: #fff;
    padding: 12px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.04em;
    white-space: nowrap;
    position: sticky;
    top: 0;
}
.result-table th:first-child { border-top-left-radius: var(--radius); }
.result-table th:last-child  { border-top-right-radius: var(--radius); }
.result-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    color: var(--body);
}
.result-table td:first-child {
    color: var(--heading);
    font-weight: 600;
    width: 40px;
    text-align: center;
}
.result-table td.num {
    font-family: var(--font-mono);
    text-align: right;
    white-space: nowrap;
    color: var(--heading);
    font-feature-settings: "tnum" 1;
}
.result-table tr:nth-child(even) td { background: var(--row-stripe); }
.result-table tr:hover td { background: var(--primary-bg); }
.result-table tr:last-child td { border-bottom: none; }

/* Allergen disclosure row */
.result-table tr.allergen td { background: var(--caution-bg) !important; }
.result-table tr.allergen td:first-child::before {
    content: '⚠';
    color: var(--caution-text);
    margin-right: 4px;
}

/* ─── Issues / Warnings ─── */
.issues {
    margin: 8px 0 0 18px;
    color: var(--banned-text);
    font-size: 13px;
}
.warnings {
    margin-top: 12px;
    font-size: 13px;
    color: var(--body);
}
.warnings summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 600;
    padding: 4px 0;
}
.warnings summary:hover { color: var(--primary-hover); }
.warnings ul { margin: 6px 0 0 18px; }

.ttl-note {
    font-size: 12px;
    color: var(--caption);
    margin-left: 12px;
}

/* ─── Footer ─── */
.footer {
    text-align: center;
    padding: 32px 24px 48px;
    color: var(--caption);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
    background: var(--card-bg);
}
.footer .footer-brand {
    display: block;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 3px;
    margin-bottom: 6px;
}
.footer .footer-note { color: var(--caption); }

/* ─── Responsive ─── */
@media (max-width: 720px) {
    .top-bar { padding: 0 16px; }
    .nav-label { display: none; }
    .container { padding: 0 16px; margin: 16px auto; }
    .card { padding: 20px; }
    .meta-grid { grid-template-columns: 1fr; row-gap: 4px; }
    .meta-grid dt { color: var(--caption); font-size: 12px; }
    .result-table { font-size: 12px; }
    .result-table th, .result-table td { padding: 8px 10px; }
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
}
