/* Pages Management Styles */

.main-content {
    min-height: calc(100vh - 80px);
    background: #f9fafb;
    padding: 24px;
}

.pages-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.pages-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 20px;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

.pages-header .header-left {
    width: 100%;
    text-align: center;
}

.header-left h1.pages-title {
    font-size: 32px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px 0;
}

.pages-subtitle {
    font-size: 16px;
    color: #6b7280;
    margin: 0;
}

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

.btn-primary {
    padding: var(--ui-btn-padding-y) calc(var(--ui-btn-padding-x) * 1.66);
    background: var(--ui-color-primary);
    color: var(--ui-color-primary-contrast);
    border: 1px solid var(--ui-color-primary);
    border-radius: var(--ui-radius-sm);
    font-size: var(--ui-btn-font-size);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--ui-color-primary-hover);
    border-color: var(--ui-color-primary-hover);
}

/* Tabs Navigation */
.pages-tabs {
    display: flex;
    gap: 0;
    background: transparent;
    margin-bottom: 0;
    padding: 12px 0 0 0;
}

.pages-tab {
    padding: 12px 24px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    margin-left: 0;
    margin-right: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pages-tab:hover {
    background: #F9FAFB;
    border-radius: 8px 8px 0 0;
}

.pages-tab.active {
    color: #374151;
    background: white;
    font-weight: 500;
    border-radius: 8px 8px 0 0;
    position: relative;
    z-index: 10;
}

.pages-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #6366f1;
}

.tab-count {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    background: #F3F4F6;
    color: #6B7280;
}

.pages-tab.active .tab-count {
    background: #E0E7FF;
    color: #6366f1;
}

.pages-tab-content {
    display: none;
    background: white;
    border-radius: 0 12px 12px 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.pages-tab-content.active {
    display: block;
}

/* Domains List Styles */
.domains-container {
    min-height: 400px;
}

/* Allow 404 combobox popovers to escape the domains list card */
.domains-container.domains-container--dropdown-open {
    overflow: visible;
}

/* Domains tab panel: lift above siblings and avoid clipping popovers */
#domainsTab.pages-tab-content.domains-tab--dropdown-open {
    overflow: visible;
    position: relative;
    z-index: 100;
}

/* Domains Table Styles */
.domains-table-container {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
}

/* Allow 404 combobox dropdown to extend past the rounded panel */
.domains-table-container.domains-table-container--dropdown-open {
    overflow: visible;
}

/* Table rows: elevate the row whose 404 dropdown is open so the menu paints above rows below */
.domains-table tbody tr.domain-row {
    position: relative;
    z-index: 0;
}

.domains-table tbody tr.domain-row.domain-row--nf-open {
    z-index: 20000;
}

.domains-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.domains-table thead {
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.domains-table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.domains-table th:last-child {
    text-align: right;
}

.domains-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.2s ease;
}

.domains-table tbody tr:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

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

.domains-table td {
    padding: 16px 20px;
    vertical-align: middle;
}

.domain-name-cell {
    min-width: 200px;
}

.domain-name-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.domain-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.domain-name {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.domain-status-cell {
    white-space: nowrap;
}

.domain-ssl-cell {
    white-space: nowrap;
}

.domain-pages-cell {
    white-space: nowrap;
    text-align: center;
}

.domain-pages-count {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.domain-not-found-cell {
    min-width: 180px;
    max-width: 280px;
    position: relative;
}

/* Match strategy-canvas LLM combobox (canvas-model-combobox) for 404 page picker */
.domains-table-container .domain-not-found-combobox.canvas-model-combobox {
    position: relative;
    width: 100%;
}

.domains-table-container .canvas-model-combobox-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    color: #111827;
    background: #fff;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.domains-table-container .canvas-model-combobox-trigger:hover:not(:disabled) {
    border-color: #9ca3af;
}

.domains-table-container .canvas-model-combobox-trigger:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.domains-table-container .canvas-model-combobox.is-open .canvas-model-combobox-trigger {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.domains-table-container .canvas-model-combobox-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.domains-table-container .canvas-model-combobox-chevron {
    flex-shrink: 0;
    color: #6b7280;
    transition: transform 0.2s ease;
}

.domains-table-container .canvas-model-combobox.is-open .canvas-model-combobox-chevron {
    transform: rotate(180deg);
}

.domains-table-container .canvas-model-combobox-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 20001;
    padding: 8px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow:
        0 10px 25px -5px rgba(0, 0, 0, 0.18),
        0 8px 10px -6px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(15, 23, 42, 0.06);
}

/*
 * 404 page dropdown: when open, JS moves this panel to document.body, so it is NOT under .domains-table-container.
 * These rules must apply without that ancestor (same pattern as canvas agent model combobox).
 */
.domain-not-found-dropdown.canvas-model-combobox-dropdown {
    padding: 8px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-sizing: border-box;
}

.domain-not-found-dropdown.canvas-model-combobox-dropdown.canvas-model-combobox-dropdown--layer {
    position: fixed;
    min-width: 340px;
    z-index: 10400;
    left: auto;
    right: auto;
    top: auto;
    box-shadow:
        0 10px 25px -5px rgba(0, 0, 0, 0.2),
        0 8px 10px -6px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(15, 23, 42, 0.08);
}

.domain-not-found-dropdown .canvas-model-combobox-search {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    color: #111827;
    font-family: inherit;
    box-sizing: border-box;
}

.domain-not-found-dropdown .canvas-model-combobox-search:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.12);
}

.domain-not-found-dropdown .canvas-model-combobox-list {
    max-height: 220px;
    overflow-y: auto;
    margin: 0 -2px;
    padding: 2px;
}

.domain-not-found-dropdown .canvas-model-combobox-option {
    display: block;
    width: 100%;
    padding: 8px 10px;
    margin: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 13px;
    color: #111827;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease;
}

.domain-not-found-dropdown .canvas-model-combobox-option:hover:not(.is-selected) {
    background: #f3f4f6;
}

.domain-not-found-dropdown .canvas-model-combobox-option.is-selected {
    background: rgba(16, 185, 129, 0.1);
    color: #1d4ed8;
    font-weight: 500;
}

.domain-not-found-dropdown .canvas-model-combobox-empty {
    padding: 12px 10px;
    font-size: 13px;
    color: #6b7280;
    text-align: center;
}

.domains-table-container .canvas-model-combobox-search {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    color: #111827;
    font-family: inherit;
    box-sizing: border-box;
}

.domains-table-container .canvas-model-combobox-search:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.12);
}

.domains-table-container .canvas-model-combobox-list {
    max-height: 220px;
    overflow-y: auto;
    margin: 0 -2px;
    padding: 2px;
}

.domains-table-container .canvas-model-combobox-option {
    display: block;
    width: 100%;
    padding: 8px 10px;
    margin: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 13px;
    color: #111827;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease;
}

.domains-table-container .canvas-model-combobox-option:hover:not(.is-selected) {
    background: #f3f4f6;
}

.domains-table-container .canvas-model-combobox-option.is-selected {
    background: rgba(16, 185, 129, 0.1);
    color: #1d4ed8;
    font-weight: 500;
}

.domains-table-container .canvas-model-combobox-empty {
    padding: 12px 10px;
    font-size: 13px;
    color: #6b7280;
    text-align: center;
}

.domains-table-container .canvas-model-select-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.domain-not-found-readonly {
    font-size: 13px;
    color: #374151;
}

.domain-verified-cell {
    white-space: nowrap;
}

.domain-actions-cell {
    text-align: right;
}

.domain-details-row {
    background: #f9fafb;
}

.domain-details-row td {
    padding: 24px;
    border-top: 1px solid #e5e7eb;
}

.domain-details-content {
    padding: 0;
}

.domain-row[data-expanded="true"] {
    background: #f9fafb;
}

/* Legacy domain-card styles for backward compatibility */
.domain-card {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
}

.domain-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-color: #D1D5DB;
}

.domain-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 16px;
    border-bottom: 1px solid #E5E7EB;
    transition: background-color 0.2s ease;
}

.domain-card-header:hover {
    background-color: #F9FAFB;
}

.domain-card-header > div {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.domain-card-toggle {
    transition: transform 0.2s ease;
    color: #6B7280;
}

.domain-card[data-expanded="true"] .domain-card-toggle,
.domain-card .domain-card-header[aria-expanded="true"] ~ .domain-card-toggle {
    transform: rotate(180deg);
}

.domain-details {
    padding: 16px;
    border-top: 1px solid #E5E7EB;
    background-color: #F9FAFB;
}

.domain-dns-instructions {
    margin-top: 8px;
}

.dns-instructions-section {
    margin-top: 16px;
}

.dns-instructions-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
}

.dns-instructions-section h5 {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 16px 0 8px 0;
}

.dns-instructions-intro {
    font-size: 14px;
    color: #6B7280;
    margin: 0 0 16px 0;
}

.dns-record-box {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.dns-record-box p {
    font-size: 14px;
    color: #374151;
    margin: 8px 0;
}

.dns-record-box code.dns-value {
    display: inline-block;
    background: #F3F4F6;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    color: #111827;
    word-break: break-all;
}

.dns-note {
    font-size: 13px;
    color: #6B7280;
    font-style: italic;
    margin-top: 12px !important;
}

.dns-copy-section {
    margin-top: 12px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    background: #3c82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-small:hover {
    background: #2563eb;
}

.loading-state-small {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    color: #6B7280;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid #E5E7EB;
    border-top-color: #6366F1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.error-state-small {
    padding: 16px;
    color: #DC2626;
    font-size: 14px;
}

.domain-card-actions {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid #E5E7EB;
    flex-wrap: wrap;
}

.domain-card-actions .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #F3F4F6;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: all 0.2s ease;
}

.domain-card-actions .btn-secondary:hover {
    background: #E5E7EB;
    border-color: #9CA3AF;
}

.domain-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
}

.domain-name {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.domain-status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.domain-status-badge.verified {
    background: #D1FAE5;
    color: #065F46;
}

.domain-status-badge.pending {
    background: #FEF3C7;
    color: #92400E;
}

.domain-status-badge.failed {
    background: #FEE2E2;
    color: #991B1B;
}

.domain-ssl-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

.domain-ssl-badge.ssl-active {
    background: #d1fae5;
    color: #065f46;
}

.domain-ssl-badge.ssl-pending {
    background: #fef3c7;
    color: #92400e;
}

.domain-ssl-badge.ssl-none {
    background: #fee2e2;
    color: #991b1b;
}

.domain-ssl-badge.ssl-error {
    background: #f3f4f6;
    color: #6b7280;
}

.spinner-small-inline {
    width: 12px;
    height: 12px;
    border: 2px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

.domain-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.domain-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #6B7280;
}

.domain-info-item strong {
    color: #374151;
    min-width: 100px;
}

.domain-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.domain-card-actions .btn-icon.danger {
    color: #DC2626;
}

.domain-card-actions .btn-icon.danger:hover {
    background: #FEE2E2;
    border-color: #FCA5A5;
    color: #991B1B;
}

.domain-card-actions .btn-icon {
    padding: 8px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.domain-card-actions .btn-icon:hover {
    background: #F3F4F6;
    border-color: #D1D5DB;
}

/* Filters */
.pages-filters {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    background: #ffffff;
    border-radius: 12px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.filter-select, .filter-input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    min-width: 200px;
    transition: border-color 0.2s ease;
}

.filter-select:focus, .filter-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.filter-input {
    min-width: 300px;
}

/* Pages List */
.pages-list-container {
    background: #ffffff;
    border-radius: 12px;

    min-height: 400px;
}

.loading-state, .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.loading-state .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

.empty-state svg {
    color: #9ca3af;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
}

.empty-state p {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px 0;
}

/* Pages Table */
.pages-table-container {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    max-width: 100%;
    overflow-x: auto;
}

/* Main list: pagination below table */
.pages-list-pagination {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    padding: 16px 24px 28px 16px;
    box-sizing: border-box;
}

.pages-list-pagination-info {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
}

.pages-list-pagination-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.pages-list-pagination-size {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.pages-list-page-size-select {
    padding: 6px 10px;
    font-size: 13px;
    color: #374151;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    min-height: 36px;
}

.pages-list-page-size-select:hover {
    border-color: #9ca3af;
}

.pages-list-page-indicator {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    padding: 0 4px;
    min-width: 7.5rem;
    text-align: center;
}

.pages-list-page-btn {
    min-width: 88px;
}

.pages-list-page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pages-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
}

.pages-table thead {
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.pages-table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.pages-table th:last-child {
    text-align: right;
}

.pages-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.2s ease;
}

.pages-table tbody tr:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

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

.pages-table td {
    padding: 16px 20px;
    vertical-align: top;
}

.page-name-cell {
    min-width: 300px;
    width: 55%;
}

.page-name-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.shared-badge {
    display: inline-flex;
    align-items: center;
    gap: 0;
    font-size: 11px;
    color: #047857;
    font-weight: 600;
    background: #ecfdf5;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid #d1fae5;
    white-space: nowrap;
    margin-left: 8px;
}

.page-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-table-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    line-height: 1.3;
    transition: all 0.2s ease;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.page-title-button {
    background: none;
    border: none;
    padding: 0;
    text-align: left;
    cursor: pointer;
}

.page-title-button:hover {
    color: inherit;
    text-decoration: none;
}

.page-title-button:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
    border-radius: 4px;
}

.page-table-description {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.page-url-display {
    margin-top: 4px;
    max-width: 100%;
}

.page-url-link {
    font-size: 11px;
    color: #6366f1;
    text-decoration: none;
    font-family: 'Monaco', 'Courier New', monospace;
    word-break: break-all;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.page-url-link:hover {
    text-decoration: underline;
}

.page-url-placeholder {
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
}

.page-status-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.page-status-badge.published {
    background: #ecfdf5;
    color: #047857;
    border-color: #d1fae5;
}

.page-status-badge.draft {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #e5e7eb;
}

.page-status-cell {
    white-space: nowrap;
}

.page-views-cell {
    white-space: nowrap;
}

.page-views-count {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.page-time-cell {
    white-space: nowrap;
}

.time-ago {
    font-size: 14px;
    color: #6b7280;
}

.page-actions-cell {
    text-align: right;
    width: 220px;
    min-width: 220px;
}

.table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    position: relative;
    flex-wrap: wrap;
    overflow: visible;
}

.table-action-menu {
    position: relative;
    display: inline-flex;
}

.table-action-btn.more {
    padding: 6px;
}

.table-action-dropdown {
    position: fixed;
    top: 0;
    left: 0;
    min-width: 200px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
    padding: 6px;
    display: none;
    z-index: 1000;
}

.table-action-menu.open .table-action-dropdown {
    display: block;
}

.action-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    text-align: left;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.action-menu-item:hover {
    background: #f3f4f6;
    color: #111827;
}

.action-menu-item.danger {
    color: #dc2626;
}

.action-menu-item.danger:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.table-action-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--ui-color-border);
    border-radius: var(--ui-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ui-color-text-muted);
    position: relative;
}

.btn-verify {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
}

.table-action-btn:hover {
    background: var(--ui-color-surface-alt);
    border-color: var(--ui-color-border-strong);
    color: var(--ui-gray-750);
}

.table-action-btn.delete:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #dc2626;
}

/* Tooltip styling - using JavaScript for positioning */
.table-action-btn[title] {
    position: relative;
}

.table-action-tooltip {
    position: fixed;
    padding: 6px 10px;
    background: #111827;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 6px;
    pointer-events: none;
    z-index: 99999;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    opacity: 0;
    animation: tooltipFadeIn 0.2s ease forwards;
}

.table-action-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #111827;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--ui-color-border);
    border-radius: var(--ui-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ui-color-text-muted);
}

.btn-icon:hover {
    background: var(--ui-color-surface-alt);
    border-color: var(--ui-color-border-strong);
    color: var(--ui-gray-750);
}

.btn-icon.danger:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #dc2626;
}

/* Responsive table */
@media (max-width: 768px) {
    .pages-table-container {
        border-radius: 12px;
        overflow-x: auto;
    }

    #pagesTab .pages-tab-panel .pages-table-container {
        border-radius: 0;
    }

    .pages-table {
        min-width: 600px;
    }

    .pages-table th,
    .pages-table td {
        padding: 12px 16px;
    }

    .pages-table th {
        font-size: 12px;
    }

    .page-table-title {
        font-size: 15px;
    }

    .page-table-description {
        font-size: 12px;
    }

    .domains-table-container {
        border-radius: 12px;
        overflow-x: auto;
    }

    .domains-table-container.domains-table-container--dropdown-open {
        overflow: visible;
    }

    .domains-table {
        min-width: 600px;
    }

    .domains-table th,
    .domains-table td {
        padding: 12px 16px;
    }

    .domains-table th {
        font-size: 12px;
    }

    .domain-name {
        font-size: 15px;
    }
}

.btn-secondary {
    padding: var(--ui-btn-padding-y) calc(var(--ui-btn-padding-x) * 1.33);
    background: var(--ui-color-surface-elevated);
    color: var(--ui-gray-750);
    border: 1px solid var(--ui-color-border);
    border-radius: var(--ui-radius-sm);
    font-size: var(--ui-btn-font-size);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--ui-color-surface-alt);
    border-color: var(--ui-color-border-strong);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.modal-content {
    background: var(--ui-color-surface-elevated);
    border-radius: var(--ui-radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--ui-shadow-lg);
}

.modal-content-large {
    max-width: 800px;
}

/* Create page modal — method picker + panels */
.modal-content--create-page {
    max-width: 720px;
    width: 100%;
}

.modal-header--create-page {
    gap: 16px;
}

.modal-header--create-page h2 {
    margin-bottom: 4px;
}

.create-page-modal-lead {
    font-size: 14px;
    font-weight: 400;
    color: #6b7280;
    margin: 0;
    line-height: 1.45;
}

.modal-body--create-page {
    padding-top: 8px;
}

.create-page-wizard {
    --create-card-radius: 12px;
}

.create-page-method-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 8px;
}

.create-page-method-grid.create-page-method-grid--two-cols {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 640px) {
    .create-page-method-grid {
        grid-template-columns: 1fr;
    }

    .create-page-method-grid.create-page-method-grid--two-cols {
        grid-template-columns: 1fr;
    }
}

.create-page-method-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    margin: 0;
    padding: 14px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: var(--create-card-radius);
    background: #fafbfc;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
    color: inherit;
    width: 100%;
    min-height: 108px;
}

.create-page-method-card:hover {
    border-color: #c7d2fe;
    background: #f8fafc;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.create-page-method-card:focus-visible {
    outline: none;
    border-color: var(--ui-color-primary, #3c82f6);
    box-shadow: 0 0 0 3px rgba(60, 130, 246, 0.2);
}

.create-page-method-card.is-active {
    border-color: var(--ui-color-primary, #3c82f6);
    background: linear-gradient(165deg, rgba(60, 130, 246, 0.06) 0%, #ffffff 55%);
    box-shadow: 0 1px 2px rgba(60, 130, 246, 0.12);
}

.create-page-method-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(60, 130, 246, 0.1);
    color: var(--ui-color-primary, #3c82f6);
    margin-bottom: 10px;
}

.create-page-method-card.is-active .create-page-method-icon {
    background: rgba(60, 130, 246, 0.16);
    color: var(--ui-color-primary, #2563eb);
}

.create-page-method-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    width: 100%;
}

.create-page-method-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    letter-spacing: -0.01em;
}

.create-page-method-beta-badge {
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #9a3412;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    padding: 3px 6px;
    border-radius: 4px;
    line-height: 1;
}

.create-page-method-card.is-active .create-page-method-beta-badge {
    background: #ffedd5;
    border-color: #fdba74;
}

.create-page-method-admin-only-badge {
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #1e293b;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    padding: 3px 6px;
    border-radius: 4px;
    line-height: 1;
}

.create-page-method-card.is-active .create-page-method-admin-only-badge {
    background: #cbd5e1;
    border-color: #94a3b8;
    color: #0f172a;
}

.create-page-method-desc {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: #6b7280;
    line-height: 1.4;
    margin-top: 4px;
}

.create-page-panels {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f3f4f6;
}

.create-page-panel {
    animation: createPagePanelIn 0.2s ease;
}

@keyframes createPagePanelIn {
    from {
        opacity: 0.85;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.create-page-panel-intro {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    margin: 0 0 18px 0;
}

.create-page-panel .form-group:last-of-type {
    margin-bottom: 0;
}

.create-page-panel-cta {
    width: 100%;
    justify-content: center;
    margin-top: 20px;
}

.create-page-panel--guide .guides-list {
    max-height: min(360px, 45vh);
}

.label-optional {
    font-weight: 400;
    color: #9ca3af;
    font-size: 13px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header.modal-header--create-page {
    align-items: flex-start;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #374151;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    max-height: calc(100vh - 200px);
}

/* Status Modal Tabs */
.status-modal-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 24px;
    padding-bottom: 0;
}

.status-tab {
    padding: 12px 20px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    position: relative;
}

.status-tab:hover {
    color: #374151;
    background: #f9fafb;
}

.status-tab.active {
    color: #6366f1;
    border-bottom-color: #6366f1;
    font-weight: 600;
}

.status-tab-content {
    display: none;
}

.status-tab-content.active {
    display: block;
}

/* Analytics Styles */
.analytics-section {
    margin-bottom: 2rem;
}

.analytics-section:last-child {
    margin-bottom: 0;
}

.analytics-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.analytics-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.analytics-card-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: block;
}

.analytics-card-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

.visitor-profiles-table table td,
.visitor-profiles-table table th {
    vertical-align: top;
}

.visitor-primary-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.visitor-secondary-text {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
}

.visitor-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.visitor-status-badge--identified {
    background: #dcfce7;
    color: #166534;
}

.visitor-status-badge--anonymous {
    background: #e5e7eb;
    color: #374151;
}

.visitor-status-badge--deterministic {
    background: #dbeafe;
    color: #1d4ed8;
}

.visitor-status-badge--high {
    background: #dcfce7;
    color: #166534;
}

.visitor-status-badge--medium {
    background: #fef3c7;
    color: #92400e;
}

.visitor-status-badge--low,
.visitor-status-badge--unknown {
    background: #f3f4f6;
    color: #4b5563;
}

.visitor-profiles-pagination {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.visitor-profiles-pagination-actions {
    display: flex;
    gap: 8px;
}

.visitor-profiles-empty {
    padding: 32px 20px;
}

.visitor-profile-modal-content {
    max-width: 1080px;
    max-height: min(88vh, 980px);
    border-radius: 20px;
    overflow: hidden;
}

.visitor-profile-modal-header {
    padding: 24px 16px 16px;
}

.visitor-profile-modal-body {
    padding: 0 0 28px 0;
}

.visitor-profile-modal-body #visitorProfileModalBody {
    padding-top: 8px;
}

/* Edge-to-edge content; inner sections use consistent horizontal padding */
.visitor-profile-modal-body .visitor-profile-detail {
    padding: 0 16px;
}

.visitor-profile-modal-body .visitor-profile-panel {
    margin-left: -16px;
    margin-right: -16px;
    width: calc(100% + 32px);
    box-sizing: border-box;
    padding: 20px 16px;
    border-radius: 0;
}

/* Visitor profile: compact metric & identity pills (no outer box) */
.visitor-profile-modal-body .visitor-profile-metrics,
.visitor-profile-modal-body .visitor-profile-identity-strip {
    margin-left: -16px;
    margin-right: -16px;
    width: calc(100% + 32px);
    padding: 0 16px;
    box-sizing: border-box;
}

.visitor-profile-metrics,
.visitor-profile-identity-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    align-items: flex-start;
    list-style: none;
    margin: 0;
    padding: 0;
}

.visitor-profile-identity-strip {
    margin-top: 4px;
}

.visitor-profile-identity-strip-title {
    margin: 0 0 8px 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #6b7280;
}

.visitor-profile-metric-pill,
.visitor-profile-identity-pill {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    max-width: 100%;
    padding: 5px 9px 6px;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    background: #fafafa;
}

.visitor-profile-metric-pill-label,
.visitor-profile-identity-pill-key {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b7280;
    line-height: 1.2;
}

.visitor-profile-metric-pill-value,
.visitor-profile-identity-pill-val {
    font-size: 11px;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.3;
    word-break: break-word;
}

.visitor-profile-identity-pill-val {
    font-weight: 400;
    color: #374151;
}

/* Full-width log-style tables inside visitor profile modal */
.visitor-profile-modal-section--table {
    margin-top: 0;
}

.visitor-profile-modal-body .visitor-profile-modal-section--table h3 {
    margin: 0 -16px 10px;
    padding: 0 12px;
    width: calc(100% + 32px);
    box-sizing: border-box;
    font-size: 18px;
    color: #111827;
}

.visitor-profile-modal-section--table h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #111827;
}

/* Breaks out of .visitor-profile-detail horizontal padding (same as tables) */
.visitor-profile-modal-fullbleed {
    margin-left: -16px;
    margin-right: -16px;
    width: calc(100% + 32px);
}

.visitor-profile-log-table-wrap {
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
}

.visitor-profile-log-table-wrap--scroll {
    max-height: min(42vh, 420px);
    overflow: auto;
}

.visitor-profile-log-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    font-size: 12px;
    line-height: 1.35;
    table-layout: fixed;
}

.visitor-profile-log-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b7280;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.visitor-profile-log-table tbody td {
    padding: 7px 12px;
    border-bottom: 1px solid #eceef2;
    color: #374151;
    vertical-align: top;
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.visitor-profile-log-table tbody tr:last-child td {
    border-bottom: none;
}

.visitor-profile-log-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.7);
}

.visitor-profile-log-col-time {
    width: 22%;
}

.visitor-profile-log-col-type {
    width: 12%;
}

.visitor-profile-log-col-page {
    width: 26%;
}

.visitor-profile-log-col-page-wide {
    width: 38%;
}

.visitor-profile-log-col-num {
    width: 11%;
    text-align: left;
}

.visitor-profile-log-col-detail {
    width: 40%;
}

.visitor-profile-log-cell-num {
    text-align: left;
    font-variant-numeric: tabular-nums;
    color: #4b5563;
}

.visitor-profile-log-cell-muted {
    color: #6b7280;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.visitor-profile-log-cell-detail {
    color: #6b7280;
    font-size: 11px;
}

.visitor-profile-log-empty {
    padding: 16px 12px !important;
    text-align: left;
    color: #9ca3af;
    font-size: 13px;
}

.visitor-profile-log-type {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #eef2ff;
    color: #4338ca;
}

.visitor-profile-log-type--visit {
    background: #ecfeff;
    color: #0e7490;
}

.visitor-profile-log-type--submission {
    background: #fef3c7;
    color: #92400e;
}

.visitor-profile-detail {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.visitor-profile-panel {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 24px;
}

.visitor-profile-panel h3 {
    margin: 0 0 18px 0;
    font-size: 18px;
    color: #111827;
}

.visitor-profile-detail .analytics-table {
    margin-top: 8px;
}

.visitor-profile-detail .analytics-table table th,
.visitor-profile-detail .analytics-table table td {
    padding: 14px 16px;
    text-align: left;
}

.visitor-profile-data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.visitor-profile-data-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.visitor-profile-data-key {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.visitor-profile-data-value {
    font-size: 14px;
    color: #111827;
    word-break: break-word;
}

.visitor-profile-timeline {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.visitor-profile-timeline-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px 20px;
    text-align: left;
}

.visitor-profile-timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    color: #111827;
}

.visitor-profile-date {
    font-size: 0.95rem;
    line-height: 1.45;
}

@media (max-width: 768px) {
    .visitor-profile-modal-content {
        max-height: 92vh;
        border-radius: 16px;
    }

    .visitor-profile-modal-header {
        padding: 20px 12px 14px;
    }

    .visitor-profile-modal-body {
        padding: 0 0 20px 0;
    }

    .visitor-profile-modal-body .visitor-profile-detail {
        padding: 0 12px;
    }

    .visitor-profile-modal-body .visitor-profile-modal-fullbleed,
    .visitor-profile-modal-fullbleed {
        margin-left: -12px;
        margin-right: -12px;
        width: calc(100% + 24px);
    }

    .visitor-profile-modal-body .visitor-profile-metrics,
    .visitor-profile-modal-body .visitor-profile-identity-strip,
    .visitor-profile-modal-body .visitor-profile-panel {
        margin-left: -12px;
        margin-right: -12px;
        width: calc(100% + 24px);
    }

    .visitor-profile-modal-body .visitor-profile-metrics,
    .visitor-profile-modal-body .visitor-profile-identity-strip {
        padding: 0 12px;
    }

    .visitor-profile-modal-body .visitor-profile-modal-section--table h3 {
        margin-left: -12px;
        margin-right: -12px;
        width: calc(100% + 24px);
        padding: 0 12px;
    }

    .visitor-profile-detail {
        gap: 20px;
    }

    .visitor-profile-panel {
        padding: 18px;
    }

    .visitor-profile-detail .analytics-table table th,
    .visitor-profile-detail .analytics-table table td {
        padding: 12px;
    }

    .visitor-profile-timeline-item {
        padding: 16px;
    }
}

.analytics-list {
    margin-top: 1rem;
}

.analytics-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.analytics-list-item:last-child {
    border-bottom: none;
}

.analytics-list-label {
    color: #374151;
    font-size: 0.875rem;
}

.analytics-list-value {
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
}

.analytics-table {
    margin-top: 1rem;
    overflow-x: auto;
}

.analytics-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.analytics-table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.analytics-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.analytics-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    color: #6b7280;
}

.analytics-table tbody tr:hover {
    background: #f9fafb;
}

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

.modal-description {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px 0;
}

.guides-section {
    margin-top: 24px;
}

.create-page-panel.guides-section {
    margin-top: 0;
}

.guides-section .form-group {
    margin-bottom: 16px;
}

.guides-section .form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.guides-section .form-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 16px 0;
}

.modal-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: #9ca3af;
    font-size: 14px;
}

.modal-divider::before,
.modal-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e5e7eb;
}

.modal-divider span {
    padding: 0 16px;
}

.spinner-small-inline {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

.guides-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.guide-item {
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.guide-item:hover {
    border-color: #6366f1;
    background: #f9fafb;
}

.guide-item-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px 0;
}

.guide-item-meta {
    font-size: 12px;
    color: #6b7280;
}

/* Settings Modal Styles */
.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
}

.settings-description {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px 0;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: var(--ui-input-padding-y) var(--ui-input-padding-x);
    border: 1px solid var(--ui-color-border);
    border-radius: var(--ui-radius-sm);
    font-size: var(--ui-input-font-size);
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--ui-color-primary);
    box-shadow: var(--ui-focus-ring);
}

.form-help {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 6px;
}

.domain-status-section {
    margin: 24px 0;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.domain-info {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.domain-status-info {
    margin-bottom: 16px;
}

.domain-status-info p {
    font-size: 14px;
    color: #374151;
    margin: 8px 0;
}

.domain-status-info p strong {
    font-weight: 600;
    color: #111827;
}

.domain-status-info.verified {
    color: #065f46;
}

.domain-status-info.verified p {
    color: #065f46;
}

.domain-status-info.pending {
    color: #92400e;
}

.domain-status-info.pending p {
    color: #92400e;
}

.domain-status-info.failed {
    color: #991b1b;
}

.domain-status-info.failed p {
    color: #991b1b;
}

.domain-status-info a {
    color: #6366f1;
    text-decoration: none;
}

.domain-status-info a:hover {
    text-decoration: underline;
}

.domain-instructions {
    margin-top: 20px;
    padding: 16px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.domain-instructions.routing-instructions {
    background: #f0f9ff;
    border-color: #6366f1;
}

.domain-instructions h4 {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 12px 0;
}

.dns-record-box {
    background: #f9fafb;
    padding: 12px;
    border-radius: 6px;
    margin: 12px 0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.dns-record-box p {
    margin: 6px 0;
    color: #374151;
}

.dns-record-box code {
    background: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    color: #6366f1;
    font-weight: 600;
}

.dns-note {
    font-size: 12px;
    color: #6b7280;
    margin: 12px 0 0 0;
    font-style: italic;
}

.dns-instructions-intro {
    font-size: 14px;
    color: #374151;
    margin: 0 0 16px 0;
}

.dns-instructions-note {
    font-size: 13px;
    color: #6366f1;
    font-weight: 500;
    margin: 12px 0;
    padding: 8px 12px;
    background: #eef2ff;
    border-radius: 4px;
    border-left: 3px solid #6366f1;
}

.dns-copy-section {
    margin: 12px 0;
}

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

.settings-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.error-state {
    padding: 20px;
    text-align: center;
    color: #991b1b;
}

.error-state p {
    margin: 0;
    font-size: 14px;
}

/* Submissions Modal Styles */
.submissions-summary {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.submissions-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-export-all {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #6366f1;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-export-all:hover {
    background: #f9fafb;
    border-color: #3c82f6;
    color: #2563eb;
}

.btn-export-all svg {
    display: inline-block;
    vertical-align: middle;
}

.summary-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.stat-card {
    background: #f9fafb;
    padding: 16px 20px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    min-width: min(150px, 100%);
    flex: 1 1 140px;
    box-sizing: border-box;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.form-submissions-section {
    margin-bottom: 32px;
}

.form-submissions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.form-submissions-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.webhook-rerun-one-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.form-rerun-webhook-url-index {
    max-width: min(220px, 36vw);
    padding: 6px 8px;
    font-size: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    color: #374151;
}

.btn-export-form {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #6366f1;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-export-form:hover {
    background: #f9fafb;
    border-color: #3c82f6;
    color: #2563eb;
}

.btn-export-form svg {
    display: inline-block;
    vertical-align: middle;
}

.form-submissions-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.form-name-editable {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.form-name-input {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    color: #1f2937 !important;
    width: 100% !important;
    max-width: 400px !important;
    border-bottom: 2px solid transparent !important;
    transition: border-color 0.2s ease !important;
}

.form-name-input:focus {
    outline: none !important;
    border-bottom-color: #6366f1 !important;
}

.form-name-input::placeholder {
    color: #9ca3af !important;
    font-weight: 400 !important;
    opacity: 1 !important;
}

.form-name-input.form-name-placeholder::placeholder {
    color: #6366f1 !important;
    font-weight: 500 !important;
}

.btn-save-form-name {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
    background: #6366f1;
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-save-form-name:hover {
    background: #2563eb;
    transform: scale(1.05);
}

.btn-save-form-name:active {
    transform: scale(0.95);
}

.submission-count-badge {
    background: #6366f1;
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.submissions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.submission-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
}

.submission-item:hover {
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.submission-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.submission-number {
    font-weight: 600;
    color: #6366f1;
    font-size: 14px;
}

.submission-date {
    font-size: 13px;
    color: #6b7280;
    flex: 1;
}

.webhook-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.webhook-status.success {
    background: #d1fae5;
    color: #065f46;
}

.webhook-status.error {
    background: #fee2e2;
    color: #991b1b;
}

.webhook-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.webhook-status.muted {
    background: #f3f4f6;
    color: #6b7280;
}

.submission-data {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.submission-field {
    display: flex;
    gap: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.submission-field strong {
    font-weight: 600;
    color: #374151;
    min-width: 120px;
}

.submission-field span {
    color: #111827;
    flex: 1;
}

.no-submissions {
    text-align: center;
    padding: 24px;
    color: #6b7280;
    font-size: 14px;
    font-style: italic;
}

/* Submissions Table Styles */
.submissions-table-wrapper {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
}

.submissions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.submissions-table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.submissions-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.submissions-table th.col-number {
    width: 60px;
    text-align: center;
}

.submissions-table th.col-date {
    width: 180px;
}

.submissions-table th.col-ip {
    width: 140px;
}

.submissions-table th.col-location {
    width: 220px;
}

.submissions-table th.col-status {
    width: 100px;
    text-align: center;
}

.submissions-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
}

.submissions-table tbody tr:hover {
    background-color: #f9fafb;
}

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

.submissions-table td {
    padding: 12px 16px;
    color: #111827;
    vertical-align: top;
}

.submissions-table td.col-number {
    text-align: center;
    font-weight: 600;
    color: #6366f1;
    font-size: 13px;
}

.submissions-table td.col-date {
    color: #6b7280;
    font-size: 13px;
    white-space: nowrap;
}

.submissions-table td.col-ip {
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.submissions-table td.col-location {
    font-size: 13px;
    color: #374151;
    max-width: 220px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.submissions-table td.col-field {
    max-width: 300px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.submissions-table td.col-status {
    text-align: center;
}

.submissions-table .webhook-status {
    display: inline-block;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
    white-space: nowrap;
}

.submissions-table .webhook-status.success {
    background: #d1fae5;
    color: #065f46;
}

.submissions-table .webhook-status.error {
    background: #fee2e2;
    color: #991b1b;
    cursor: help;
}

.submissions-table .webhook-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.submissions-table .webhook-status.muted {
    background: #f3f4f6;
    color: #6b7280;
}

.submissions-table .webhook-status:not(.success):not(.error):not(.pending):not(.muted) {
    color: #9ca3af;
}

.submissions-table td.col-actions {
    text-align: center;
    white-space: nowrap;
}

.webhook-action-muted {
    color: #9ca3af;
}

.table-action-btn.submissions {
    color: #3c82f6;
}

.table-action-btn.submissions:hover {
    background: #eef2ff;
    color: #2563eb;
}

/* Responsive */
@media (max-width: 768px) {
    .pages-header {
        align-items: center;
    }

    .pages-filters {
        flex-direction: column;
    }

    .filter-select, .filter-input {
        min-width: 100%;
    }
}

/* Folder Sidebar Styles */
.pages-content-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* Pages tab: one white panel under tabs — folders | list (toolbar + table) */
#pagesTab .pages-content-layout.pages-tab-panel {
    position: relative;
    gap: 0;
    align-items: stretch;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Folder column: shell wraps sidebar (collapse control lives in folder header) */
#pagesTab .pages-tab-panel .folder-sidebar-shell {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    flex-shrink: 0;
    flex-basis: auto;
    width: auto;
    min-width: 0;
    min-height: 0;
    max-width: 352px;
    background: #ffffff;
    border-radius: 12px 0 0 12px;
    border-right: 1px solid #e5e7eb;
    overflow: hidden;
    align-self: stretch;
    transition:
        max-width 0.48s cubic-bezier(0.33, 1, 0.68, 1),
        border-color 0.4s ease,
        background-color 0.4s ease,
        border-radius 0.35s ease;
}

/* Collapsed: drive width only via max-width (avoid flex: 0 0 0 — it snaps flex-basis to 0 instantly) */
#pagesTab .pages-tab-panel .folder-sidebar-shell--collapsed {
    flex-shrink: 0;
    flex-basis: auto;
    max-width: 0;
    min-width: 0;
    overflow: hidden;
    border-color: transparent;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

#pagesTab .pages-tab-panel .folder-sidebar-shell--collapsed ~ .pages-main-content {
    border-radius: 12px;
}

.app-list-toolbar--filters-row .pages-toolbar-primary-actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.pages-show-folders-btn {
    align-items: center;
    min-height: 36px;
}

@keyframes pagesShowFoldersIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#pagesTab .pages-tab-panel .folder-sidebar-shell--collapsed ~ .pages-main-content .pages-show-folders-btn {
    animation: pagesShowFoldersIn 0.34s cubic-bezier(0.33, 1, 0.68, 1) both;
}

@media (prefers-reduced-motion: reduce) {
    #pagesTab .pages-tab-panel .folder-sidebar-shell,
    #pagesTab .pages-tab-panel .folder-sidebar,
    #pagesTab .pages-tab-panel .pages-main-content {
        transition-duration: 0.01ms !important;
    }

    #pagesTab .pages-tab-panel .folder-sidebar-shell--collapsed ~ .pages-main-content .pages-show-folders-btn {
        animation: none;
    }
}

#pagesTab .pages-tab-panel .folder-sidebar {
    border: none;
    padding: 16px 18px;
    background: #ffffff;
    border-radius: 0;
    align-self: stretch;
    flex: 0 0 300px;
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    overflow-x: hidden;
    overflow-y: auto;
    transform: translate3d(0, 0, 0);
    opacity: 1;
    transition:
        opacity 0.34s cubic-bezier(0.33, 1, 0.68, 1),
        transform 0.48s cubic-bezier(0.33, 1, 0.68, 1),
        padding 0.4s cubic-bezier(0.33, 1, 0.68, 1),
        min-width 0.48s cubic-bezier(0.33, 1, 0.68, 1),
        max-width 0.48s cubic-bezier(0.33, 1, 0.68, 1);
}

/* Hide: same easing as Show folders; transitions run when class toggles (no keyframes — avoids animating on first paint if already collapsed) */
#pagesTab .pages-tab-panel .folder-sidebar-shell--collapsed .folder-sidebar {
    opacity: 0;
    transform: translate3d(-12px, 0, 0);
    flex: 0 1 auto;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    pointer-events: none;
}

#pagesTab .pages-tab-panel .pages-main-content {
    flex: 1;
    min-width: 0;
    border-radius: 0 12px 12px 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-radius 0.42s cubic-bezier(0.33, 1, 0.68, 1);
}

#pagesTab .pages-tab-panel .pages-main-content .app-list-shell {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    flex: 1;
    min-height: 0;
}

/* Flush list + table — no inner rounded “card” inside the panel */
#pagesTab .pages-tab-panel .pages-list-container {
    border-radius: 0;
}

#pagesTab .pages-tab-panel .pages-table-container {
    border-radius: 0;
    border: none;
    box-shadow: none;
}

#pagesTab .pages-tab-panel .pages-table tbody tr:hover {
    box-shadow: none;
}

.folder-sidebar {
    width: 300px;
    min-width: 300px;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

/* Inside pages tab panel, width comes from #pagesTab rules above */
#pagesTab .pages-tab-panel .folder-sidebar {
    position: static;
    top: auto;
    max-height: none;
    min-height: 0;
}

.folder-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: none;
}

.folder-sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.folder-sidebar-collapse-icon {
    flex-shrink: 0;
}

.folder-sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: #F3F4F6;
    border-color: #d1d5db;
    color: #374151;
}

.folder-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #374151;
    font-size: 14px;
    position: relative;
    padding-right: 60px; /* Space for count/actions on the right */
}

.folder-item:hover {
    background: #F9FAFB;
}

.folder-item.active {
    background: #EFF6FF;
    color: #2563EB;
    font-weight: 500;
}

.folder-item svg {
    flex-shrink: 0;
    color: inherit;
}

.folder-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0; /* Allow flex item to shrink */
}

.folder-count {
    font-size: 12px;
    color: #9CA3AF;
    background: #F3F4F6;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.folder-item.active .folder-count {
    background: #DBEAFE;
    color: #2563EB;
}

.folder-item:hover .folder-count {
    opacity: 0;
}

.folder-shared-icon {
    color: #059669 !important;
}

.folder-item:hover .folder-shared-icon {
    color: #047857 !important;
}

.move-folder-option .folder-shared-icon {
    color: #059669 !important;
}

.folder-toggle {
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.folder-toggle.expanded {
    transform: rotate(90deg);
}

.folder-toggle-spacer {
    width: 5px;
    flex-shrink: 0;
}

.folder-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.folder-item:hover .folder-actions {
    opacity: 1;
    pointer-events: auto;
}

.btn-icon-small {
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    border-radius: 4px;
    transition: all 0.2s ease;
    pointer-events: auto;
}

.btn-icon-small:hover {
    background: #F3F4F6;
    color: #111827;
}

.folder-actions .btn-icon-small:last-child:hover {
    background: #FEE2E2;
    color: #DC2626;
}

.folder-children {
    margin-left: 12px;
    margin-top: 4px;
}

.folder-item-wrapper {
    display: flex;
    flex-direction: column;
}

.pages-main-content {
    flex: 1;
    min-width: 0;
}

/* Move Folder Modal Styles */
.move-folder-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 8px;
}

.move-folder-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #374151;
    font-size: 14px;
}

.move-folder-option:hover {
    background: #F9FAFB;
}

.move-folder-option svg {
    flex-shrink: 0;
    color: #6B7280;
}

/* Responsive */
@media (max-width: 768px) {
    .pages-content-layout {
        flex-direction: column;
    }

    .folder-sidebar {
        width: 100%;
        min-width: auto;
        position: static;
        max-height: none;
    }

    #pagesTab .pages-tab-panel .folder-sidebar-shell {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        border-radius: 12px 12px 0 0;
        width: 100%;
        max-width: 100%;
        max-height: min(50vh, 380px);
        transition:
            max-width 0.48s cubic-bezier(0.33, 1, 0.68, 1),
            max-height 0.45s cubic-bezier(0.33, 1, 0.68, 1),
            padding 0.4s cubic-bezier(0.33, 1, 0.68, 1),
            border-color 0.35s ease,
            background-color 0.35s ease;
    }

    #pagesTab .pages-tab-panel .folder-sidebar-shell--collapsed {
        width: 100%;
        max-width: 100%;
        max-height: 0;
        min-height: 0;
        border-bottom: none;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    #pagesTab .pages-tab-panel .folder-sidebar {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        max-width: none;
        transition:
            opacity 0.34s cubic-bezier(0.33, 1, 0.68, 1),
            transform 0.45s cubic-bezier(0.33, 1, 0.68, 1),
            padding 0.4s cubic-bezier(0.33, 1, 0.68, 1);
    }

    #pagesTab .pages-tab-panel .folder-sidebar-shell--collapsed .folder-sidebar {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
        max-width: none;
        padding-left: 0;
        padding-right: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin: 0;
        min-height: 0;
        opacity: 0;
        transform: translate3d(0, -8px, 0);
        pointer-events: none;
        overflow: hidden;
    }

    #pagesTab .pages-tab-panel .pages-main-content {
        border-radius: 0 0 12px 12px;
    }
}

/* Auto-Generate Wizard Styles (Admin Only) */
.auto-generate-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wizard-header {
    margin-bottom: 32px;
}

.wizard-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px 0;
}

.wizard-header p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.wizard-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 32px;
    position: relative;
}

.wizard-progress::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e5e7eb;
    z-index: 0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.progress-step.active .step-number {
    background: #3c82f6;
    color: #ffffff;
}

.progress-step.completed .step-number {
    background: #10b981;
    color: #ffffff;
}

.step-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-align: center;
}

.progress-step.active .step-label {
    color: #3c82f6;
    font-weight: 600;
}

.progress-step.completed .step-label {
    color: #10b981;
}

.wizard-content {
    min-height: 400px;
    margin-bottom: 32px;
}

.wizard-step {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wizard-step h3 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
}

.step-description {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px 0;
}

.source-type-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.source-tab {
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.source-tab:hover {
    border-color: #3c82f6;
    background: #f0f9ff;
}

.source-tab.active {
    border-color: #3c82f6;
    background: #eff6ff;
    color: #3c82f6;
}

.source-tab svg {
    width: 32px;
    height: 32px;
}

.extraction-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.extracted-preview {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}

.extracted-preview h4 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 12px 0;
}

.review-summary {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
}

.review-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.review-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.review-item strong {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.review-item span {
    font-size: 14px;
    color: #6b7280;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

.wizard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.btn-secondary {
    padding: 10px 20px;
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.form-input,
.form-select {
    width: 100%;
    padding: var(--ui-input-padding-y) var(--ui-input-padding-x);
    border: 1px solid var(--ui-color-border);
    border-radius: var(--ui-radius-sm);
    font-size: var(--ui-input-font-size);
    color: var(--ui-color-text);
    transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--ui-color-primary);
    box-shadow: var(--ui-focus-ring);
}

.form-help {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: #6b7280;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #3c82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* Clone panel — options (create page modal) */
.clone-from-url-lead {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    margin: 0 0 18px 0;
}

.clone-from-url-beta-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    line-height: 1.5;
    color: #4b5563;
    margin: 0 0 18px 0;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.clone-from-url-beta-badge {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9a3412;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    padding: 3px 8px;
    border-radius: 4px;
    line-height: 1.2;
    margin-top: 1px;
}

.clone-from-url-beta-text {
    flex: 1;
    min-width: 0;
}

.clone-from-url-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 20px;
    margin-top: 4px;
    margin-bottom: 4px;
}

.clone-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    user-select: none;
}

.clone-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--ui-color-primary, #3c82f6);
}

/* Responsive wizard */
@media (max-width: 768px) {
    .wizard-progress {
        flex-wrap: wrap;
        gap: 16px;
    }

    .progress-step {
        flex: 0 0 calc(50% - 8px);
    }

    .source-type-tabs {
        grid-template-columns: 1fr;
    }

    .wizard-actions {
        flex-direction: column-reverse;
        gap: 12px;
    }

    .wizard-actions button {
        width: 100%;
        justify-content: center;
    }
}

/* Minimal app footer (/strategy, /quizzes, /pages) */
.strategy-page-footer {
    padding: 28px 24px 36px;
    text-align: center;
    background: var(--qb-bg);
    border: none;
    box-shadow: none;
}

.strategy-page-footer-copy {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 400;
    color: var(--qb-text-secondary, #64748b);
    letter-spacing: 0.02em;
}

.strategy-page-footer-privacy {
    font-size: 13px;
    font-weight: 500;
    color: var(--qb-text-heading, #0f172a);
    text-decoration: none;
    border: none;
    transition: color 0.15s ease;
}

.strategy-page-footer-privacy:hover {
    color: var(--qb-primary);
}
