/* ============================================
   Web Manifest Validator — Styles
   Theme: Dark mode + Coral palette
   ============================================ */

:root {
    --primary: #FF6B6B;
    --primary-hover: #FF8585;
    --primary-dim: rgba(255, 107, 107, 0.15);
    --secondary: #FFA07A;
    --secondary-dim: rgba(255, 160, 122, 0.15);
    --bg: #1A0E0E;
    --bg-card: rgba(40, 20, 20, 0.6);
    --bg-hover: rgba(255, 107, 107, 0.08);
    --bg-input: rgba(26, 14, 14, 0.9);
    --surface: rgba(50, 28, 28, 0.5);
    --border: rgba(255, 107, 107, 0.12);
    --border-focus: rgba(255, 107, 107, 0.5);
    --text: #F5E8E8;
    --text-secondary: #BF9090;
    --text-dim: #7A5555;
    --success: #00B894;
    --success-dim: rgba(0, 184, 148, 0.15);
    --warning: #FDCB6E;
    --warning-dim: rgba(253, 203, 110, 0.15);
    --danger: #FF6B6B;
    --danger-dim: rgba(255, 107, 107, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --transition: 250ms ease;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --glass: blur(16px) saturate(180%);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

body::before {
    content: '';
    position: fixed;
    top: -30%;
    right: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(255, 107, 107, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* --- Header --- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: rgba(26, 14, 14, 0.85);
    backdrop-filter: var(--glass);
    border-bottom: 1px solid var(--border);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-subtitle {
    font-size: 0.8rem;
    color: var(--text-dim);
    border-left: 1px solid var(--border);
    padding-left: 16px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #FF8585);
    color: #1A0E0E;
    box-shadow: 0 2px 12px rgba(255, 107, 107, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.45);
}

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

.btn-secondary:hover {
    background: rgba(255, 107, 107, 0.2);
    border-color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 12px;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.btn-sm {
    font-size: 0.78rem;
    padding: 5px 10px;
}

.btn-full {
    width: 100%;
    justify-content: center;
    margin-top: 12px;
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* --- Layout --- */
.app-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    flex: 1;
    position: relative;
    z-index: 1;
}

/* --- Panel Card --- */
.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    backdrop-filter: var(--glass);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

.card-actions {
    display: flex;
    gap: 4px;
}

/* --- Input Panel --- */
.input-panel {
    padding: 20px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.input-panel .panel-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.editor-wrap {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.line-numbers {
    padding: 16px 8px 16px 12px;
    background: rgba(26, 14, 14, 0.5);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.6;
    text-align: right;
    user-select: none;
    min-width: 40px;
    overflow: hidden;
}

.code-editor {
    flex: 1;
    background: transparent;
    border: none;
    padding: 16px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    min-height: 400px;
    tab-size: 2;
}

.code-editor::placeholder {
    color: var(--text-dim);
}

/* --- Results Panel --- */
.results-panel {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* --- Score Card --- */
.score-card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    animation: fadeSlideIn 400ms ease;
}

.score-card[hidden] {
    display: none;
}

.score-ring-wrap {
    position: relative;
    width: 90px;
    height: 90px;
    flex-shrink: 0;
}

.score-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-ring-bg {
    fill: none;
    stroke: var(--surface);
    stroke-width: 6;
}

.score-ring-fg {
    fill: none;
    stroke: var(--primary);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 264;
    stroke-dashoffset: 264;
    transition: stroke-dashoffset 1s ease, stroke 500ms ease;
}

.score-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.score-details {
    flex: 1;
}

.score-details h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.score-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stat {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.stat-pass {
    background: var(--success-dim);
    color: var(--success);
}

.stat-warn {
    background: var(--warning-dim);
    color: var(--warning);
}

.stat-fail {
    background: var(--danger-dim);
    color: var(--danger);
}

/* --- Result Filters --- */
.result-filters {
    display: flex;
    gap: 4px;
}

.filter-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary-dim);
    border-color: var(--primary);
    color: var(--primary);
}

/* --- Results List --- */
.results-list {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
}

.result-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid transparent;
    transition: all var(--transition);
    animation: fadeSlideIn 300ms ease;
}

.result-item:hover {
    border-color: var(--border);
}

.result-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 1px;
}

.result-icon.pass {
    background: var(--success-dim);
    color: var(--success);
}

.result-icon.warn {
    background: var(--warning-dim);
    color: var(--warning);
}

.result-icon.fail {
    background: var(--danger-dim);
    color: var(--danger);
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-info h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.result-info p {
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.4;
}

/* --- Icon Preview --- */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    padding: 16px;
}

.icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid transparent;
    transition: all var(--transition);
}

.icon-item:hover {
    border-color: var(--border);
}

.icon-placeholder {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-xs);
    background: var(--primary-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.icon-size {
    font-size: 0.68rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

/* --- Code Output --- */
.code-output {
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--secondary);
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* --- Empty State --- */
.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.empty-state svg {
    opacity: 0.3;
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 20px;
    background: var(--primary);
    color: #1A0E0E;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    opacity: 0;
    transition: opacity 300ms ease, transform 300ms ease;
    z-index: 300;
    pointer-events: none;
}

.toast[hidden] {
    display: block;
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Animations --- */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 107, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 107, 0.35);
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .app-main {
        grid-template-columns: 1fr;
    }

    .input-panel {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .results-panel {
        max-height: none;
    }

    .header-subtitle {
        display: none;
    }

    .code-editor {
        min-height: 250px;
    }
}

@media (max-width: 540px) {
    .app-header {
        flex-direction: column;
        gap: 10px;
        padding: 12px 16px;
    }

    .header-actions {
        width: 100%;
        justify-content: stretch;
    }

    .header-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .input-panel,
    .results-panel {
        padding: 14px;
    }

    .score-card {
        flex-direction: column;
        text-align: center;
    }
}