@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    --border-color: #d0d7de;
    --header-bg: #f6f8fa;
    --row-hover-bg: #f1f3f5;
    --primary-color: #0969da;
    --text-color: #24292f;
    --cell-padding: 8px 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #ffffff;
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    font-size: 13px;
}

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

h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.btn-add {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-add:hover {
    background-color: #085ebd;
}

.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    max-height: 80vh;
    /* Allow scrolling if too long */
}

table {
    border-collapse: collapse;
    width: 100%;
    white-space: nowrap;
}

th,
td {
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: var(--cell-padding);
    text-align: left;
    min-width: 80px;
}

th:last-child,
td:last-child {
    border-right: none;
}

thead th {
    background-color: var(--header-bg);
    font-weight: 600;
    color: #57606a;
    position: sticky;
    top: 0;
    z-index: 10;
    user-select: none;
}

tbody tr:hover {
    background-color: var(--row-hover-bg);
}

/* Delete button column */
.col-delete {
    width: 24px;
    min-width: 24px;
    max-width: 24px;
    padding: 0 !important;
    text-align: center;
    border-right: none !important;
}

th.col-delete {
    background: var(--header-bg);
}

.btn-delete-row {
    display: none;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: #cf222e;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    line-height: 1;
    transition: all 0.15s;
}

.btn-delete-row:hover {
    background: #ffebe9;
}

tbody tr:hover .btn-delete-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Editable cells */
td.editable {
    cursor: cell;
}

td.editing {
    padding: 0;
}

td input.cell-editor {
    width: 100%;
    height: 100%;
    border: 2px solid var(--primary-color);
    padding: var(--cell-padding);
    box-sizing: border-box;
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: white;
    width: 500px;
    max-width: 90%;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 24px;
}

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

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #57606a;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #57606a;
}

.form-group input {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.modal-footer {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-secondary {
    background: #f6f8fa;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

/* Column specifics */
.col-number,
.col-percentage,
.col-currency,
.col-decimal {
    text-align: right;
}

.col-center {
    text-align: center;
}

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

/* Embedded view adjustments */
body.embedded {
    padding: 0;
    overflow: hidden;
    /* Recommended for iframes if using internal scroll */
}

body.embedded .table-container {
    border: none;
    border-radius: 0;
    box-shadow: none;
    max-height: 100vh;
}

#embedCodeArea {
    resize: none;
    background: #f6f8fa;
}

/* Navigation Tabs */
nav.tabs {
    background: #ffffff;
    padding: 0 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
}

nav.tabs a.tab-item {
    color: #57606a;
    text-decoration: none;
    padding: 12px 24px;
    font-weight: 500;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

nav.tabs a.tab-item:hover {
    color: var(--text-color);
    background: #f6f8fa;
}

nav.tabs a.tab-item.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: transparent;
}

/* Sub Tabs */
.sub-tabs {
    background: #f6f8fa;
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px;
}

.sub-tabs .container {
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 1400px;
    margin: 0 auto;
}

.sub-tabs a {
    text-decoration: none;
    color: #57606a;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.sub-tabs a:hover {
    background: #eaeef2;
}

.sub-tabs a.active {
    background: #ffffff;
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.campaign-selector select {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-size: 12px;
    outline: none;
}

.assessment-page .table-container {
    max-height: calc(100vh - 180px);
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.iframe-hidden {
    display: none !important;
}


.status-poor {
    background: #ffebe9;
    color: #cf222e;
}

.status-stable {
    background: #fff8c5;
    color: #9a6700;
}

.status-meets {
    background: #dafbe1;
    color: #1a7f37;
}

.status-exceeds {
    background: #ddf4ff;
    color: #0969da;
}

.status-excellent {
    background: #fbefff;
    color: #8250df;
}

.campaign-badge {
    background: #0969da;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 10px;
}

/* Add Row Zone - Spreadsheet-like */
.add-row-zone {
    padding: 12px 20px;
    text-align: center;
    color: #8c959f;
    font-size: 12px;
    cursor: pointer;
    border-top: 1px dashed var(--border-color);
    background: #fafbfc;
    transition: all 0.2s;
    user-select: none;
}

.add-row-zone:hover {
    background: #f0f3f6;
    color: var(--primary-color);
}

.add-row-zone span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Table container focus state for paste */
.table-container:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.table-container.paste-ready {
    background: linear-gradient(to bottom, #ddf4ff 0%, transparent 50px);
}

/* New row highlight animation */
tr.new-row {
    animation: highlightNew 2s ease-out;
}

@keyframes highlightNew {
    0% {
        background-color: #ddf4ff;
    }

    100% {
        background-color: transparent;
    }
}

/* Paste notification toast */
.paste-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1f883d;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

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

/* New editable row */
.new-editable-row {
    background: #fffbeb !important;
}

.new-editable-row td {
    padding: 4px 6px !important;
}

.new-editable-row input.new-row-input:focus {
    border-color: #0969da;
    outline: none;
    box-shadow: 0 0 0 2px rgba(9, 105, 218, 0.15);
}