/**
 * ToolDuck — cURL Tools Stylesheet (curl-tool.css)
 * ===============================================================
 * Color coding, component breakdowns, diff markers, code generators,
 * and responsive side-by-side layouts for cURL Parser and cURL Compare.
 */

/* ---------------------------------------------------------------
   1. Layout & Header Switcher
   --------------------------------------------------------------- */
.curl-app {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.curl-mode-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    padding: .85rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}

.curl-mode-pills {
    display: flex;
    align-items: center;
    gap: .35rem;
    background: var(--bg-muted);
    padding: .25rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.curl-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .85rem;
    font-size: .84rem;
    font-weight: 600;
    color: var(--ink-3);
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-sm) - 2px);
    cursor: pointer;
    text-decoration: none;
    transition: all .15s ease;
}

.curl-mode-btn:hover {
    color: var(--ink);
    background: var(--surface);
}

.curl-mode-btn.is-active {
    color: var(--brand-strong);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

.curl-mode-actions {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
}

/* ---------------------------------------------------------------
   2. Input Area & Toolbar
   --------------------------------------------------------------- */
.curl-input-box {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
}

.curl-input-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
}

.curl-input-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 700;
    font-size: .95rem;
    color: var(--ink);
}

.curl-badge-count {
    font-size: .74rem;
    font-weight: 600;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: var(--bg-muted);
    color: var(--ink-3);
    border: 1px solid var(--border);
}

.curl-textarea {
    width: 100%;
    min-height: 8.5rem;
    font-family: var(--mono);
    font-size: .88rem;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .85rem;
    resize: vertical;
    tab-size: 2;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.curl-textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--focus-ring);
}

/* ---------------------------------------------------------------
   3. Color-Coded Method Badges
   --------------------------------------------------------------- */
.curl-method {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .2rem .65rem;
    font-family: var(--mono);
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .06em;
    border-radius: 6px;
    text-transform: uppercase;
    line-height: 1.2;
}

.curl-method--get {
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}
.curl-method--post {
    color: #1d4ed8;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}
.curl-method--put {
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
}
.curl-method--patch {
    color: #7e22ce;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
}
.curl-method--delete {
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
}
.curl-method--head,
.curl-method--options {
    color: #4338ca;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
}

html[data-theme="dark"] .curl-method--get {
    color: #34d399;
    background: rgba(16, 185, 129, .15);
    border-color: rgba(16, 185, 129, .35);
}
html[data-theme="dark"] .curl-method--post {
    color: #60a5fa;
    background: rgba(59, 130, 246, .15);
    border-color: rgba(59, 130, 246, .35);
}
html[data-theme="dark"] .curl-method--put {
    color: #fbbf24;
    background: rgba(245, 158, 11, .15);
    border-color: rgba(245, 158, 11, .35);
}
html[data-theme="dark"] .curl-method--patch {
    color: #c084fc;
    background: rgba(168, 85, 247, .15);
    border-color: rgba(168, 85, 247, .35);
}
html[data-theme="dark"] .curl-method--delete {
    color: #f87171;
    background: rgba(239, 68, 68, .15);
    border-color: rgba(239, 68, 68, .35);
}
html[data-theme="dark"] .curl-method--head,
html[data-theme="dark"] .curl-method--options {
    color: #818cf8;
    background: rgba(99, 102, 241, .15);
    border-color: rgba(99, 102, 241, .35);
}

/* ---------------------------------------------------------------
   4. Color-Coded URL Inspector Bar
   --------------------------------------------------------------- */
.curl-url-card {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
}

.curl-url-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .65rem .9rem;
    font-family: var(--mono);
    font-size: .88rem;
    line-height: 1.5;
    word-break: break-all;
}

.curl-url-segments {
    display: inline;
}

.curl-url-proto {
    color: #7c3aed;
    font-weight: 600;
}
.curl-url-host {
    color: #2563eb;
    font-weight: 700;
}
.curl-url-port {
    color: #d97706;
    font-weight: 600;
}
.curl-url-path {
    color: #059669;
    font-weight: 600;
}
.curl-url-query {
    color: #ea580c;
    font-weight: 500;
}

html[data-theme="dark"] .curl-url-proto { color: #c084fc; }
html[data-theme="dark"] .curl-url-host  { color: #60a5fa; }
html[data-theme="dark"] .curl-url-port  { color: #fbbf24; }
html[data-theme="dark"] .curl-url-path  { color: #34d399; }
html[data-theme="dark"] .curl-url-query { color: #fb923c; }

/* ---------------------------------------------------------------
   5. Parser Breakdown Cards & Tables
   --------------------------------------------------------------- */
.curl-section-card {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
}

.curl-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
}

.curl-section-title {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-size: .98rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
}

.curl-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.curl-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .86rem;
    text-align: left;
}

.curl-table th {
    background: var(--bg-muted);
    color: var(--ink-3);
    font-weight: 700;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .65rem .85rem;
    border-bottom: 1px solid var(--border);
}

.curl-table td {
    padding: .65rem .85rem;
    border-bottom: 1px solid var(--border);
    color: var(--ink);
    vertical-align: middle;
}

.curl-table tr:last-child td {
    border-bottom: none;
}

.curl-table tr:hover td {
    background: var(--bg-soft);
}

.curl-prop-key {
    font-family: var(--mono);
    font-weight: 600;
    color: var(--brand-strong);
    white-space: nowrap;
}

.curl-prop-val {
    font-family: var(--mono);
    color: var(--ink);
    word-break: break-all;
}

.curl-badge-tag {
    display: inline-block;
    padding: .15rem .45rem;
    font-size: .72rem;
    font-weight: 600;
    border-radius: 4px;
    background: var(--bg-muted);
    color: var(--ink-3);
    border: 1px solid var(--border);
    text-transform: uppercase;
}

.curl-badge-tag--auth {
    color: #92400e;
    background: #fffbeb;
    border-color: #fde68a;
}
html[data-theme="dark"] .curl-badge-tag--auth {
    color: #fbbf24;
    background: rgba(245, 158, 11, .15);
    border-color: rgba(245, 158, 11, .3);
}

/* ---------------------------------------------------------------
   6. Color-Coded JSON Syntax Highlighting
   --------------------------------------------------------------- */
.curl-code-block {
    position: relative;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .95rem 1.1rem;
    font-family: var(--mono);
    font-size: .86rem;
    line-height: 1.6;
    overflow-x: auto;
    max-height: 480px;
    white-space: pre;
    color: var(--ink);
}

.curl-json-key    { color: #2563eb; font-weight: 600; }
.curl-json-string { color: #059669; }
.curl-json-number { color: #d97706; }
.curl-json-bool   { color: #7c3aed; font-weight: 600; }
.curl-json-null   { color: #64748b; font-style: italic; }
.curl-json-punct  { color: var(--ink-3); }

html[data-theme="dark"] .curl-json-key    { color: #60a5fa; }
html[data-theme="dark"] .curl-json-string { color: #34d399; }
html[data-theme="dark"] .curl-json-number { color: #fbbf24; }
html[data-theme="dark"] .curl-json-bool   { color: #c084fc; }
html[data-theme="dark"] .curl-json-null   { color: #94a3b8; }

/* ---------------------------------------------------------------
   7. Code Generator Tabs
   --------------------------------------------------------------- */
.curl-codegen-tabs {
    display: flex;
    gap: .35rem;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    padding-bottom: .25rem;
    margin-bottom: .85rem;
}

.curl-codegen-tab {
    padding: .45rem .85rem;
    font-size: .83rem;
    font-weight: 600;
    color: var(--ink-3);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s ease;
}

.curl-codegen-tab:hover {
    color: var(--ink);
}

.curl-codegen-tab.is-active {
    color: var(--brand-strong);
    border-bottom-color: var(--brand);
    font-weight: 700;
}

/* ---------------------------------------------------------------
   8. cURL Compare: Side-by-Side Editors & Diff Matrix
   --------------------------------------------------------------- */
.curl-cmp-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 900px) {
    .curl-cmp-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.curl-cmp-side {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
}

.curl-diff-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    padding: .95rem 1.2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
}

.curl-diff-banner--match {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}
html[data-theme="dark"] .curl-diff-banner--match {
    background: rgba(16, 185, 129, .15);
    border-color: rgba(16, 185, 129, .35);
    color: #34d399;
}

.curl-diff-banner--diff {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}
html[data-theme="dark"] .curl-diff-banner--diff {
    background: rgba(245, 158, 11, .15);
    border-color: rgba(245, 158, 11, .35);
    color: #fbbf24;
}

.curl-diff-banner-title {
    display: flex;
    align-items: center;
    gap: .65rem;
    font-weight: 700;
    font-size: .96rem;
}

/* Diff Filter Bar */
.curl-diff-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .65rem;
    padding: .45rem 0;
}

.curl-diff-pills {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
}

.curl-diff-pill {
    padding: .35rem .75rem;
    font-size: .82rem;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink-3);
    cursor: pointer;
    transition: all .15s ease;
}

.curl-diff-pill:hover {
    color: var(--ink);
    border-color: var(--border-strong);
}

.curl-diff-pill.is-active {
    background: var(--brand);
    color: var(--on-brand);
    border-color: var(--brand);
}

/* Diff Cards */
.curl-diff-card {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
}

.curl-diff-item {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: .75rem .95rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: .875rem;
}

/* Added row */
.curl-diff-item--added {
    background: rgba(16, 185, 129, .07);
    border-color: rgba(16, 185, 129, .25);
}
.diff-badge--added {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .15rem .45rem;
    font-size: .72rem;
    font-weight: 700;
    border-radius: 4px;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}
html[data-theme="dark"] .diff-badge--added {
    color: #34d399;
    background: rgba(16, 185, 129, .2);
    border-color: rgba(16, 185, 129, .4);
}

/* Removed row */
.curl-diff-item--removed {
    background: rgba(239, 68, 68, .07);
    border-color: rgba(239, 68, 68, .25);
}
.diff-badge--removed {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .15rem .45rem;
    font-size: .72rem;
    font-weight: 700;
    border-radius: 4px;
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
}
html[data-theme="dark"] .diff-badge--removed {
    color: #f87171;
    background: rgba(239, 68, 68, .2);
    border-color: rgba(239, 68, 68, .4);
}

/* Modified row */
.curl-diff-item--modified {
    background: rgba(245, 158, 11, .07);
    border-color: rgba(245, 158, 11, .25);
}
.diff-badge--modified {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .15rem .45rem;
    font-size: .72rem;
    font-weight: 700;
    border-radius: 4px;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
}
html[data-theme="dark"] .diff-badge--modified {
    color: #fbbf24;
    background: rgba(245, 158, 11, .2);
    border-color: rgba(245, 158, 11, .4);
}

/* Unchanged row */
.curl-diff-item--unchanged {
    background: var(--bg-soft);
    border-color: var(--border);
    opacity: .75;
}

.curl-diff-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem;
    margin-top: .35rem;
}
@media (min-width: 640px) {
    .curl-diff-split {
        grid-template-columns: 1fr 1fr;
    }
}

.curl-diff-col {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .45rem .65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: .83rem;
    word-break: break-all;
}

.curl-diff-col-label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-3);
    margin-bottom: .15rem;
}

/* Empty / Null state */
.curl-empty-hint {
    padding: 1.5rem;
    text-align: center;
    color: var(--ink-3);
    font-size: .92rem;
}
