/* ==========================================================================
   UTM Parameter Builder - utmb-style.css
   Prefix: utmb-
   ========================================================================== */

.utmb-wrap *,
.utmb-wrap *::before,
.utmb-wrap *::after { box-sizing: border-box; }

.utmb-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: #1f2937;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px 48px;
}

.utmb-main-title   { font-size: 1.55rem; font-weight: 700; color: #111827; margin: 0 0 8px; }
.utmb-main-subtitle{ font-size: 0.92rem; color: #6b7280; margin: 0 0 22px; }

/* --------------------------------------------------------------------------
   Mode tabs
   -------------------------------------------------------------------------- */
.utmb-mode-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 24px;
}

.utmb-mode-tab {
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.15s, border-color 0.15s;
}
.utmb-mode-tab:hover   { color: #2563eb; }
.utmb-mode-active      { color: #2563eb; border-bottom-color: #2563eb; }

.utmb-mode-panel       { display: none; }
.utmb-mode-panel-active{ display: block; }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.utmb-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    align-items: start;
}
@media (max-width: 860px) {
    .utmb-layout { grid-template-columns: 1fr; }
    .utmb-right { order: -1; position: static; }
    .utmb-left  { order: 1; }
}

/* Keep the generated URL and tips visible while scrolling the long input column */
.utmb-right {
    position: sticky;
    top: 32px;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.utmb-card {
    background: #fff;
    border: 1px solid #dde3ea;
    border-radius: 10px;
    padding: 22px 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.utmb-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f2f5;
}

.utmb-section-note { font-size: 0.82rem; color: #6b7280; margin: -6px 0 14px; }

/* --------------------------------------------------------------------------
   Presets grid
   -------------------------------------------------------------------------- */
.utmb-presets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.utmb-preset-btn {
    padding: 8px 10px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    background: #f8faff;
    color: #2563eb;
    border: 1.5px solid #bfdbfe;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-align: center;
}
.utmb-preset-btn:hover         { background: #dbeafe; border-color: #93c5fd; }
.utmb-preset-btn.utmb-preset-active { background: #2563eb; color: #fff; border-color: #2563eb; }

/* --------------------------------------------------------------------------
   Fields
   -------------------------------------------------------------------------- */
.utmb-field { margin-bottom: 16px; }
.utmb-field:last-of-type { margin-bottom: 0; }

.utmb-field label {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #374151;
    margin-bottom: 5px;
}

.utmb-req      { color: #e53935; }
.utmb-optional { color: #9ca3af; font-weight: 400; text-transform: none; letter-spacing: 0; }

.utmb-param-tag {
    font-size: 0.72rem;
    font-weight: 600;
    font-family: 'SFMono-Regular', Consolas, monospace;
    background: #e0e7ff;
    color: #3730a3;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: none;
    letter-spacing: 0;
}

.utmb-field input[type="text"],
.utmb-field input[type="url"],
.utmb-field textarea {
    width: 100%;
    padding: 9px 12px;
    font-size: 0.9rem;
    font-family: inherit;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    background: #fafafa;
    color: #1f2937;
    transition: border-color 0.2s;
    resize: vertical;
}
.utmb-field input:focus,
.utmb-field textarea:focus {
    outline: none;
    border-color: #2563eb;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.utmb-field input.utmb-input-warn { border-color: #d97706; }
.utmb-field input.utmb-input-ok   { border-color: #16a34a; }

.utmb-hint { font-size: 0.75rem; color: #9ca3af; margin: 4px 0 0; }

/* --------------------------------------------------------------------------
   Options (checkboxes)
   -------------------------------------------------------------------------- */
.utmb-options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 14px 0 0;
}
.utmb-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.85rem;
    color: #4b5563;
    cursor: pointer;
    user-select: none;
}
.utmb-toggle input[type="checkbox"] {
    width: 15px; height: 15px;
    accent-color: #2563eb;
    cursor: pointer;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.utmb-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.utmb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 7px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.utmb-btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.utmb-btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.utmb-btn-outline { background: transparent; color: #2563eb; border-color: #2563eb; }
.utmb-btn-outline:hover { background: #eff6ff; }
.utmb-btn-ghost   { background: transparent; color: #6b7280; border-color: #e5e7eb; }
.utmb-btn-ghost:hover { background: #f9fafb; }

/* --------------------------------------------------------------------------
   URL display
   -------------------------------------------------------------------------- */
.utmb-preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 4px;
}
.utmb-preview-header .utmb-card-title { margin-bottom: 0; border-bottom: none; padding-bottom: 0; }
.utmb-preview-actions .utmb-btn       { padding: 6px 14px; font-size: 0.8rem; }

.utmb-url-display {
    background: #f8fafc;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px 16px;
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.82rem;
    color: #1f2937;
    word-break: break-all;
    line-height: 1.7;
    margin-top: 14px;
    min-height: 52px;
}

.utmb-url-placeholder { color: #9ca3af; font-family: inherit; font-size: 0.88rem; }

/* colour-coded URL segments */
.utmb-url-base   { color: #1f2937; }
.utmb-url-sep    { color: #9ca3af; }
.utmb-url-key    { color: #2563eb; }
.utmb-url-val    { color: #16a34a; }

.utmb-url-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
    font-size: 0.78rem;
    color: #6b7280;
}

.utmb-length-warn {
    color: #d97706;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Errors
   -------------------------------------------------------------------------- */
.utmb-errors {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 7px;
    padding: 10px 14px;
    margin-top: 12px;
}
.utmb-errors ul { margin: 0; padding: 0 0 0 18px; color: #991b1b; font-size: 0.84rem; }

/* --------------------------------------------------------------------------
   Breakdown table
   -------------------------------------------------------------------------- */
.utmb-breakdown { margin-top: 20px; }

.utmb-breakdown-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 10px;
}

.utmb-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}
.utmb-breakdown-table th {
    background: #f3f4f6;
    color: #6b7280;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 10px;
    text-align: left;
    font-weight: 700;
}
.utmb-breakdown-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}
.utmb-breakdown-table tr:last-child td { border-bottom: none; }
.utmb-breakdown-table .utmb-td-key {
    font-family: 'SFMono-Regular', Consolas, monospace;
    color: #2563eb;
    font-size: 0.8rem;
    white-space: nowrap;
}
.utmb-breakdown-table .utmb-td-val {
    font-family: 'SFMono-Regular', Consolas, monospace;
    color: #16a34a;
    font-size: 0.8rem;
    word-break: break-all;
}

.utmb-status-set     { background: #dcfce7; color: #15803d; }
.utmb-status-missing { background: #fef2f2; color: #dc2626; }
.utmb-status-optional{ background: #f3f4f6; color: #6b7280; }

.utmb-status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   Tips card
   -------------------------------------------------------------------------- */
.utmb-tips-card { background: #f8faff; }
.utmb-tips-list {
    margin: 0;
    padding: 0 0 0 18px;
    font-size: 0.85rem;
    color: #374151;
    line-height: 1.85;
}
.utmb-tips-list code {
    background: #e0e7ff;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.82em;
    color: #3730a3;
}

/* --------------------------------------------------------------------------
   Bulk results
   -------------------------------------------------------------------------- */
.utmb-placeholder {
    text-align: center;
    padding: 36px 20px;
    color: #9ca3af;
}
.utmb-placeholder-icon { font-size: 2.5rem; margin-bottom: 8px; opacity: 0.35; }
.utmb-placeholder p    { font-size: 0.9rem; margin: 0; }

.utmb-bulk-results { display: flex; flex-direction: column; gap: 10px; }

.utmb-bulk-item {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 14px;
}
.utmb-bulk-item-num {
    font-size: 0.72rem;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.utmb-bulk-item-url {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.8rem;
    color: #1f2937;
    word-break: break-all;
    margin-bottom: 8px;
    line-height: 1.6;
}
.utmb-bulk-item-actions { display: flex; gap: 8px; }
.utmb-bulk-item-actions .utmb-btn { padding: 5px 12px; font-size: 0.78rem; }

.utmb-bulk-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.83rem;
    color: #991b1b;
}

/* --------------------------------------------------------------------------
   Responsive
   ---------------------