/* R22 Color Palette */
:root {
    --primary-blue: #0052A3;
    --primary-blue-dark: #003d7a;
    --primary-blue-light: #0066cc;
    --accent-gray: #505050;
    --accent-gray-light: #707070;
    --background-light: #f8f9fa;
    --background-white: #ffffff;
    --border-color: #e0e0e0;
    --text-primary: #2c3e50;
    --text-secondary: #666;
    --success-green: #28a745;
    --danger-red: #dc3545;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--background-light);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ===== HEADER ===== */
.header {
    background: var(--background-white);
    border-bottom: 2px solid var(--primary-blue);
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 82, 163, 0.08);
}

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

.logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-blue);
    letter-spacing: -0.5px;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 11px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 82, 163, 0.2);
}

.btn-primary:hover {
    background: var(--primary-blue-dark);
    box-shadow: 0 4px 16px rgba(0, 82, 163, 0.3);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--background-light);
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    border-color: var(--accent-gray);
}

.btn-danger {
    background: var(--danger-red);
    color: white;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
}

.btn-danger:hover {
    background: #c82333;
    box-shadow: 0 4px 16px rgba(220, 53, 69, 0.3);
    transform: translateY(-2px);
}

.btn-danger:active {
    transform: translateY(0);
}

/* ===== CONTENT AREA ===== */
.content {
    display: flex;
    flex: 1;
    gap: 12px;
    padding: 12px;
    background: var(--background-light);
    overflow: hidden;
}

/* ===== PANES ===== */
.pane {
    background: var(--background-white);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
}

.left-pane {
    flex: 0 0 48%;
}

.right-pane {
    flex: 1;
}

.pane-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    border-bottom: 2px solid var(--primary-blue-dark);
    padding: 16px 20px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.pane-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.3px;
}

.pane-content {
    flex: 1;
    overflow: auto;
    padding: 20px;
}

/* ===== JSON VIEWER ===== */
#jsonViewer {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    background: #f5f7fa;
    padding: 15px;
    border-radius: 6px;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid var(--border-color);
}

/* ===== TREE VIEWER ===== */
.tree-viewer {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
}

.tree-node {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--background-white);
    overflow: hidden;
    margin-bottom: 8px;
}

.tree-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
}

.tree-header:hover {
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.1);
}

.tree-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.toggle-icon {
    display: inline-block;
}

.tree-type {
    font-size: 14px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tree-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.15);
    padding: 3px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tree-content {
    padding: 5px 0;
}

.tree-content.hidden {
    display: none;
}

.tree-property {
    border-left: 2px solid var(--border-color);
    margin-left: 15px;
}

.tree-property-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.tree-property-header:hover {
    background: var(--background-light);
    border-left: 2px solid var(--primary-blue);
}

.tree-property-row {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 6px 12px;
}

.tree-key {
    font-weight: 600;
    color: var(--primary-blue);
    min-width: 150px;
    word-break: break-word;
}

.tree-value {
    color: var(--text-secondary);
    word-break: break-all;
    flex: 1;
    max-width: 400px;
    white-space: pre-wrap;
}

.tree-array-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--background-light);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.tree-array-item {
    padding-left: 20px;
    border-left: 1px solid var(--border-color);
}

.root-node {
    margin-bottom: 20px;
}

/* ===== TREE CONTROLS ===== */
.tree-controls {
    display: flex;
    gap: 8px;
}

.tree-control-btn {
    padding: 7px 14px;
    background: var(--accent-gray);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tree-control-btn:hover {
    background: var(--accent-gray-light);
    box-shadow: 0 2px 6px rgba(80, 80, 80, 0.2);
}

.tree-control-btn:active {
    transform: scale(0.98);
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--background-white);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 2px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
}

.modal-header h2 {
    font-size: 20px;
    color: white;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: white;
    transform: scale(1.1);
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    background: var(--background-light);
}

.tab-button {
    flex: 1;
    padding: 15px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tab-button.active {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
    background: var(--background-white);
}

.tab-button:hover {
    color: var(--primary-blue);
    background: rgba(0, 82, 163, 0.05);
}

/* ===== TAB CONTENT ===== */
.tab-content {
    padding: 24px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.tab-pane label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.3px;
}

.tab-pane input,
.tab-pane textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 12px;
    resize: vertical;
    transition: all 0.2s ease;
}

.tab-pane input:focus,
.tab-pane textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(0, 82, 163, 0.1);
}

.tab-pane small {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: -8px;
    margin-bottom: 12px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
}

/* ===== LOADING STATE ===== */
.loading-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.spinner {
    border: 3px solid var(--background-light);
    border-top: 3px solid var(--primary-blue);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
}

/* ===== WELCOME STATE ===== */
.welcome-state {
    text-align: center;
    padding: 60px 20px;
}

.welcome-state h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 700;
}

.welcome-state p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== RESULT SECTIONS ===== */
.result-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.result-section:last-child {
    border-bottom: none;
}

.result-section h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metadata-row {
    display: flex;
    gap: 16px;
    padding: 12px;
    background: var(--background-light);
    border-radius: 6px;
    margin-bottom: 8px;
}

.metadata-row label {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 100px;
}

.metadata-row value {
    color: var(--text-secondary);
}

/* ===== COMPLIANCE STATUS ===== */
.compliance-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.compliance-item {
    padding: 12px 16px;
    border-radius: 6px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.compliance-item.pass {
    background: #d4edda;
    color: #155724;
    border-color: #28a745;
}

.compliance-item.fail {
    background: #f8d7da;
    color: #721c24;
    border-color: #dc3545;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .content {
        flex-direction: column;
    }

    .left-pane,
    .right-pane {
        flex: 1 !important;
    }

    .compliance-status {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .header-left {
        width: 100%;
        justify-content: center;
    }

    .logo {
        height: 32px;
    }

    .header h1 {
        font-size: 20px;
    }

    .modal-content {
        width: 95%;
    }
}

/* ===== LEAD FORM SECTION ===== */
.lead-form-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.lead-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    border-bottom: 2px solid var(--primary-blue-dark);
    color: white;
}

.lead-form-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.3px;
}

.lead-form-container {
    flex: 1;
    overflow: hidden;
    padding: 16px;
    background: var(--background-light);
}

.monday-iframe {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
}

/* ===== LEAD FORM BANNER ===== */
.lead-form-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, rgba(0, 82, 163, 0.1) 0%, rgba(0, 82, 163, 0.05) 100%);
    border: 2px solid var(--primary-blue);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.banner-content {
    flex: 1;
}

.banner-content h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-blue);
    margin: 0 0 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.banner-content p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.lead-form-banner .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.lead-form-banner:hover {
    background: linear-gradient(135deg, rgba(0, 82, 163, 0.15) 0%, rgba(0, 82, 163, 0.08) 100%);
    border-color: var(--primary-blue-dark);
    box-shadow: 0 2px 8px rgba(0, 82, 163, 0.1);
}
