/* ==========================================================
   Security Checker - スタイルシート
   ========================================================== */

:root {
    --color-bg: #f5f7fa;
    --color-surface: #ffffff;
    --color-text: #1f2937;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-secondary: #6b7280;

    --color-safe: #10b981;
    --color-warn: #f59e0b;
    --color-danger: #ef4444;
    --color-critical: #b91c1c;

    --radius: 10px;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 6px 20px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

/* -------- Header -------- */
.site-header {
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: #fff;
    padding: 40px 0;
    box-shadow: var(--shadow);
}
.site-header .logo {
    margin: 0 0 8px;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.site-header .tagline {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

/* -------- Cards -------- */
main.container {
    padding-top: 32px;
    padding-bottom: 48px;
}
.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 24px 28px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card h2 {
    margin: 0 0 16px;
    font-size: 1.15rem;
    color: var(--color-text);
    border-left: 4px solid var(--color-primary);
    padding-left: 10px;
}

/* -------- Form -------- */
.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
#url-input {
    flex: 1;
    min-width: 240px;
    padding: 12px 14px;
    font-size: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s;
}
#url-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.checkbox-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 0.88rem;
    color: var(--color-muted);
    cursor: pointer;
    user-select: none;
    margin-bottom: 10px;
}
.checkbox-row input {
    margin-top: 4px;
    flex-shrink: 0;
}
.note {
    font-size: 0.82rem;
    color: var(--color-muted);
    margin: 8px 0 0;
}

/* -------- Buttons -------- */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.05s, background 0.15s;
    text-decoration: none;
    line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--color-primary);
    color: #fff;
}
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}
.btn-secondary {
    background: #fff;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    margin-left: 8px;
}
.btn-secondary:hover { background: #f9fafb; }

/* -------- Progress -------- */
.progress-wrapper { margin-top: 12px; }
.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--color-border);
    border-radius: 6px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), #60a5fa);
    width: 0%;
    transition: width 0.4s ease;
}
.progress-text {
    margin-top: 10px;
    color: var(--color-muted);
    font-size: 0.9rem;
}

/* -------- Result summary -------- */
.result-summary {
    display: flex;
    gap: 28px;
    align-items: center;
    flex-wrap: wrap;
}
.score-visual {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}
.score-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.ring-track {
    fill: none;
    stroke: var(--color-border);
    stroke-width: 10;
}
.ring-value {
    fill: none;
    stroke: var(--color-primary);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.2s ease, stroke 0.5s;
}
.ring-value.safe     { stroke: var(--color-safe); }
.ring-value.warn     { stroke: var(--color-warn); }
.ring-value.danger   { stroke: var(--color-danger); }
.ring-value.critical { stroke: var(--color-critical); }

.score-number {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    line-height: 1;
}
.score-number span {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--color-text);
}
.score-total {
    font-size: 0.9rem !important;
    color: var(--color-muted) !important;
    font-weight: 500 !important;
    margin-left: 2px;
}

.summary-text { flex: 1; min-width: 220px; }
.summary-text h2 {
    border: none;
    padding: 0;
    margin: 6px 0;
    font-size: 1.2rem;
    word-break: break-all;
}
.summary-text p { margin: 0; color: var(--color-muted); }

.grade-badge {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 999px;
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.05em;
}
.grade-badge.a { background: var(--color-safe); }
.grade-badge.b { background: #3b82f6; }
.grade-badge.c { background: var(--color-warn); }
.grade-badge.d { background: var(--color-danger); }
.grade-badge.f { background: var(--color-critical); }

/* -------- Category grid -------- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}
.category-card {
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #fafbfc;
}
.category-card .cat-name {
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.category-card .cat-score {
    font-size: 0.9rem;
    color: var(--color-muted);
}
.category-card .cat-bar {
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}
.category-card .cat-fill { height: 100%; transition: width 0.8s ease; }
.cat-fill.safe     { background: var(--color-safe); }
.cat-fill.warn     { background: var(--color-warn); }
.cat-fill.danger   { background: var(--color-danger); }

.cat-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
}
.cat-dot.safe   { background: var(--color-safe); }
.cat-dot.warn   { background: var(--color-warn); }
.cat-dot.danger { background: var(--color-danger); }

/* -------- Issues -------- */
.issue-list, .ok-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.issue-item {
    padding: 14px 16px;
    border-left: 4px solid var(--color-warn);
    background: #fff7ed;
    border-radius: 6px;
    margin-bottom: 10px;
}
.issue-item.severity-critical { border-color: var(--color-critical); background: #fef2f2; }
.issue-item.severity-high     { border-color: var(--color-danger);   background: #fef2f2; }
.issue-item.severity-medium   { border-color: var(--color-warn);     background: #fff7ed; }
.issue-item.severity-low      { border-color: #60a5fa;              background: #eff6ff; }

.issue-item .issue-header {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
}
.issue-item .issue-title { font-weight: 600; }
.severity-pill {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    color: #fff;
    letter-spacing: 0.05em;
}
.severity-pill.critical { background: var(--color-critical); }
.severity-pill.high     { background: var(--color-danger); }
.severity-pill.medium   { background: var(--color-warn); }
.severity-pill.low      { background: #3b82f6; }

.issue-item .issue-msg  { color: var(--color-text); font-size: 0.95rem; margin: 4px 0; }
.issue-item .issue-fix  { color: var(--color-muted); font-size: 0.85rem; margin: 4px 0 0; padding-top: 4px; border-top: 1px dashed var(--color-border); }
.issue-item .issue-fix strong { color: var(--color-text); }

.ok-list li {
    padding: 8px 12px;
    color: var(--color-muted);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--color-border);
}
.ok-list li:last-child { border: none; }
.ok-list li::before {
    content: "✓";
    color: var(--color-safe);
    font-weight: 700;
    margin-right: 8px;
}

/* -------- CTA -------- */
.cta {
    text-align: center;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
}
.cta h2 { border: none; padding: 0; }

/* -------- Meta / Footer -------- */
.meta { background: transparent; box-shadow: none; text-align: center; }
.muted { color: var(--color-muted); font-size: 0.9rem; }
.small { font-size: 0.8rem; }

.site-footer {
    padding: 28px 0;
    background: #f3f4f6;
    color: var(--color-muted);
    text-align: center;
    font-size: 0.85rem;
}
.site-footer p { margin: 2px 0; }

/* -------- Utility -------- */
.hidden { display: none !important; }

/* -------- Responsive -------- */
@media (max-width: 640px) {
    .form-row { flex-direction: column; }
    #url-input, .btn { width: 100%; }
    .btn-secondary { margin: 8px 0 0; }
    .result-summary { justify-content: center; text-align: center; }
    .site-header { padding: 28px 0; }
    .site-header .logo { font-size: 1.5rem; }
}
