/* === style.css ===
 * assets/css/style.css
 * НАЗНАЧЕНИЕ: Все стили приложения Webhook Inspector
 * РАЗМЕР: ~500 строк
 * ОБНОВЛЕНО: 2026-01-29
 */

/* ========================================
   CSS VARIABLES
   ======================================== */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-card: #171717;

    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;

    --text-primary: #fafafa;
    --text-secondary: #a3a3a3;
    --text-muted: #666666;

    --border-color: #262626;
    --border-light: #333333;

    --method-get: #10b981;
    --method-post: #f59e0b;
    --method-put: #3b82f6;
    --method-delete: #ef4444;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --transition: all 0.2s ease;
}

/* ========================================
   BASE STYLES
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ========================================
   LOGIN PAGE
   ======================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow);
}

.login-box h1 {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    background: linear-gradient(to right, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-box .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(to right, var(--accent-blue), var(--accent-purple));
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-full {
    width: 100%;
}

.btn-danger {
    background: var(--accent-red);
}

.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    box-shadow: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.error-message {
    margin-top: 16px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    color: var(--accent-red);
    font-size: 13px;
    display: none;
}

.error-message.show {
    display: block;
}

/* ========================================
   DASHBOARD LAYOUT
   ======================================== */
.dashboard {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.sidebar-title h2 {
    font-size: 14px;
    font-weight: 600;
}

.sidebar-title .count {
    font-size: 13px;
    color: var(--text-secondary);
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    font-size: 12px;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.search-box::before {
    content: "🔍";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
}

/* Webhook List */
.webhook-list {
    flex: 1;
    overflow-y: auto;
}

.webhook-item {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.webhook-item:hover {
    background: var(--bg-tertiary);
}

.webhook-item.active {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent-blue);
}

.webhook-item-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.method-badge {
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
}

.method-badge.get { background: var(--method-get); color: #000; }
.method-badge.post { background: var(--method-post); color: #000; }
.method-badge.put { background: var(--method-put); color: #fff; }
.method-badge.delete { background: var(--method-delete); color: #fff; }

.webhook-item-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 4px 0;
}

.webhook-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.webhook-id {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.webhook-time {
    font-size: 11px;
    color: var(--text-muted);
}

.webhook-event {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

.webhook-vendor-id {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 4px;
}

.webhook-comment {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Processing status badge */
.processing-status {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 500;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: auto;
}

.processing-status.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.processing-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.processing-status.partial {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.processing-status.none {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.processing-status .icon-xs {
    width: 12px;
    height: 12px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(to right, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.webhook-url {
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 6px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

/* Detail Panel */
.detail-panel {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

/* Webhook Detail */
.webhook-detail {
    max-width: 100%;
}

.detail-header {
    margin-bottom: 16px;
}

.detail-method-url {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.detail-method-url .method-badge {
    font-size: 14px;
    padding: 6px 12px;
}

.detail-method-url .url {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-all;
}

/* Two Column Layout: Meta (20%) + Headers (80%) */
.detail-top-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.detail-meta-column {
    width: 20%;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-raw-column {
    width: 80%;
    flex: 1;
}

.detail-raw-column .section-header {
    margin-bottom: 8px;
}

.detail-raw-column .raw-content {
    max-height: 350px;
    overflow-y: auto;
    background: var(--ai-dark);
    border-radius: var(--radius-md);
}

.detail-raw-column .raw-content-body pre {
    margin: 0;
    padding: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.meta-item .label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.meta-item .value {
    font-size: 13px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    word-break: break-all;
}

.meta-item .value.location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-family);
}

/* Data Sections */
.data-section {
    margin-top: 16px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.section-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

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

.data-table {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.data-table tr {
    border-bottom: 1px solid var(--border-color);
}

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

.data-table td {
    padding: 8px 12px;
    font-size: 12px;
    vertical-align: top;
}

.data-table td:first-child {
    width: 160px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    font-weight: 500;
}

.data-table td:last-child {
    font-family: var(--font-mono);
    word-break: break-all;
}

/* Raw Content */
.raw-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.raw-content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.raw-content-body {
    padding: 10px 12px;
    max-height: 350px;
    overflow: auto;
}

.raw-content-body pre {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}

.raw-content-body pre.word-wrap {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Toggle Button */
.toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.toggle-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.toggle-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Loader */
.loader {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader-small {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Load More Loader (Infinite Scroll) */
.load-more-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.notification.success {
    border-color: var(--accent-green);
}

.notification.error {
    border-color: var(--accent-red);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 400px;
    width: 90%;
}

.modal h3 {
    margin-bottom: 12px;
}

.modal p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ========================================
   LUCIDE ICONS
   ======================================== */
.icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    display: inline-block;
}

.icon-sm {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    display: inline-block;
}

.icon-large {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.empty-icon {
    width: 48px;
    height: 48px;
    stroke: var(--text-muted);
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box {
    position: relative;
}

.search-box input {
    padding-left: 32px;
}

/* Override search-box::before for Lucide */
.search-box::before {
    content: none;
}

/* Header icons alignment */
.header-right .icon,
.header-left .icon {
    margin-right: 4px;
}

/* Button icons */
.btn .icon {
    margin-right: 4px;
}

/* Section header icons */
.section-header h3 .icon {
    margin-right: 6px;
    vertical-align: -2px;
}

/* Meta item icons */
.meta-item .label .icon-sm {
    margin-right: 4px;
    vertical-align: -1px;
    opacity: 0.7;
}

/* Notification icons */
.notification .icon {
    margin-right: 6px;
    vertical-align: -2px;
}

/* Modal icons */
.modal h3 .icon {
    margin-right: 6px;
    color: var(--accent-yellow);
}

/* ========================================
   SENDPULSE PROCESSING STEPS
   ======================================== */

.sendpulse-section {
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.sendpulse-section .section-header h3 {
    color: var(--accent-purple);
}

.sendpulse-section .section-header h3 .icon {
    color: var(--accent-yellow);
}

.sendpulse-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

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

.sendpulse-section .reprocess-webhook-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sendpulse-section .reprocess-webhook-btn .icon-sm {
    width: 14px;
    height: 14px;
}

.sendpulse-section .reprocess-webhook-btn .icon-sm.spin {
    animation: spin 1s linear infinite;
}

.processing-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.processing-step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    transition: all 0.2s ease;
}

.processing-step-card:hover {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.05);
}

.processing-step-card.success {
    border-left: 3px solid var(--accent-green);
}

.processing-step-card.error {
    border-left: 3px solid var(--accent-red);
    background: rgba(239, 68, 68, 0.05);
}

.processing-step-card.skipped {
    border-left: 3px solid var(--text-muted);
    opacity: 0.7;
}

.processing-step-card.pending {
    border-left: 3px solid var(--text-muted);
    opacity: 0.5;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.processing-step-card.success .step-number {
    background: var(--accent-green);
    color: white;
}

.processing-step-card.error .step-number {
    background: var(--accent-red);
    color: white;
}

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

.step-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.step-name .icon-sm {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.step-status {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.step-status .icon-xs {
    width: 12px;
    height: 12px;
}

.step-status.success {
    color: var(--accent-green);
}

.step-status.error {
    color: var(--accent-red);
}

.step-status.skipped {
    color: var(--text-muted);
}

.step-duration {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.step-details {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.step-details .detail-row {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: flex;
    gap: 8px;
}

.step-details .detail-row .label {
    color: var(--text-muted);
    min-width: 80px;
}

.step-details .detail-row code {
    background: var(--bg-tertiary);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--accent-purple);
}

.step-details .value-highlight {
    color: var(--accent-blue);
    font-weight: 500;
}

.step-details .ok {
    color: var(--accent-green);
    font-weight: 500;
}

.step-details .fail {
    color: var(--accent-red);
    font-weight: 500;
}

.step-error {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 6px;
    font-size: 12px;
    color: var(--accent-red);
    font-family: 'JetBrains Mono', monospace;
}

/* JSON Toggle для шагов */
.step-json-toggle {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

.btn-xs {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.btn-xs.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-xs.btn-outline:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.btn-xs .icon-xs {
    width: 12px;
    height: 12px;
}

.step-json-content {
    margin-top: 10px;
}

.json-block {
    margin-bottom: 12px;
}

.json-block:last-child {
    margin-bottom: 0;
}

.json-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-purple);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.json-pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

/* Подсветка полей в JSON */
.step-details .fields-list {
    color: var(--accent-yellow);
    font-size: 12px;
}
