/* =============================================================================
   add-domains.css — styles for the Add Domains tool
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Panel Header
   ----------------------------------------------------------------------------- */

.add-domain-panel {
    max-width: 680px;
}

.panel-header {
    margin-bottom: 20px;
}

.panel-header h1 {
    margin: 0;
}

/* -----------------------------------------------------------------------------
   Mode Tabs
   ----------------------------------------------------------------------------- */

.mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color, #ddd);
}

.mode-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 8px 22px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-muted, #888);
    transition: color 0.15s, border-color 0.15s;
}

.mode-tab:hover {
    color: var(--text-color, #333);
}

.mode-tab.active {
    color: var(--primary-color, #0066cc);
    border-bottom-color: var(--primary-color, #0066cc);
}

/* -----------------------------------------------------------------------------
   Bulk CSV Textarea
   ----------------------------------------------------------------------------- */

#bulk_csv {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
}

/* -----------------------------------------------------------------------------
   Bulk Column Order Pills
   ----------------------------------------------------------------------------- */

.bulk-help-block {
    margin-bottom: 14px;
}

.bulk-column-order {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.column-pill {
    display: inline-block;
    background: var(--badge-bg, #e8f0fe);
    color: var(--badge-text, #1a56db);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.78rem;
    font-family: monospace;
    white-space: nowrap;
}

/* -----------------------------------------------------------------------------
   Field Key Labels
   ----------------------------------------------------------------------------- */

.field-key {
    font-family: monospace;
    font-size: 0.8em;
    color: var(--text-muted, #888);
    margin-left: 4px;
}

/* -----------------------------------------------------------------------------
   Category Section
   ----------------------------------------------------------------------------- */

.category-section {
    margin-top: 28px;
    padding: 14px 16px 10px;
    border-top: 2px solid var(--border-color, #e0e0e0);
    border-radius: 0 0 5px 5px;
    background: var(--row-bg, #f9f9f9);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
}

.category-section label {
    margin-top: 0 !important;
}

.category-section .help-text {
    font-size: 0.82rem;
    color: var(--text-muted, #999);
    margin-bottom: 0;
}

/* -----------------------------------------------------------------------------
   Form Actions Section
   ----------------------------------------------------------------------------- */

.form-actions-section {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--row-bg, #f9f9f9);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.form-actions-section .submit-status-text {
    margin-top: 0;
    margin-right: auto;
    text-align: left;
    flex: 1 1 auto;
    min-width: 0;
}

/* -----------------------------------------------------------------------------
   Status Messages
   ----------------------------------------------------------------------------- */

.submit-status-text {
    margin-top: 0;
    font-size: 0.88rem;
    min-height: 1.4em;
    font-weight: 500;
    transition: opacity 0.4s ease;
}

.submit-status-text:empty {
    display: none;
}

.submit-status-text.success {
    color: #1a6b35;
    background: #eaf7ee;
    border: 1px solid #b6e4c6;
    border-radius: 4px;
    padding: 6px 10px;
}

.submit-status-text.error {
    color: #922020;
    background: #fdf0f0;
    border: 1px solid #f0b8b8;
    border-radius: 4px;
    padding: 6px 10px;
}

.submit-status-text.warning {
    color: #7a4f00 !important;
    background: #fffbf0 !important;
    border: 1px solid #f0e0a0 !important;
    border-radius: 4px;
    padding: 6px 10px;
}

.submit-status-text.loading {
    color: var(--text-muted, #888);
}

/* -----------------------------------------------------------------------------
   Sidebar — Admin Config
   ----------------------------------------------------------------------------- */

/*
 * Height chain fix:
 * common.css sets #content to height:auto and #menucontrol has no height.
 * We override the whole chain here so the sidebar fills the viewport
 * with a scrollable list between the fixed search and save button.
 * #appheader is ~57px — adjust if your toolbar height differs.
 */

#content {
    align-items: stretch;
    height: calc(100vh - var(--appheader-height, 90px));
    overflow: hidden;
    flex-wrap: nowrap;
}

#menucontrol {
    display: flex !important;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

#maincontent {
    overflow-y: auto;
    height: 100%;
}

.sidebar-config {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.sidebar-config-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 14px 12px 8px;
    flex-shrink: 0;
}

.sidebar-config-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.sidebar-config-hint {
    font-size: 0.75rem;
    color: var(--text-muted, #999);
}

/* Search input — fixed, never scrolls away */
.sidebar-search-wrap {
    padding: 0 10px 8px;
    flex-shrink: 0;
}

.sidebar-search {
    width: 100%;
    box-sizing: border-box;
    padding: 5px 9px;
    border: 1px solid var(--border-color, #ccc);
    border-radius: 4px;
    font-size: 0.88rem;
    background: var(--input-bg, #fff);
    color: var(--text-color, #333);
}

.sidebar-search:focus {
    outline: none;
    border-color: var(--primary-color, #0066cc);
}

/* Column list — scrollable middle section, overrides common.css */
.sidebar-config .columns-list {
    flex: 1 1 0;             /* grow + shrink, zero base so it only takes available space */
    min-height: 0;           /* critical — allows overflow-y: auto to actually work */
    max-height: none !important;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 6px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-bottom: 0;
    background: none;
    box-shadow: none;
    border-radius: 0;
    scrollbar-width: thin;
}

/* Footer with save button — fixed at bottom, never scrolls */
.sidebar-config-footer {
    flex-shrink: 0;
    padding: 10px 10px 14px;
    border-top: 1px solid var(--border-color, #ddd);
}

.sidebar-config-footer .submit-status-text {
    margin-top: 6px;
    font-size: 0.82rem;
}

/* -----------------------------------------------------------------------------
   Column List Items
   ----------------------------------------------------------------------------- */

.columns-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: default;
    transition: background 0.1s;
    user-select: none;
}

.columns-list-item:hover {
    background: var(--row-hover-bg, #f0f4fc);
}

.columns-list-item[draggable="true"] {
    cursor: grab;
}

.columns-list-item[draggable="true"]:hover {
    background: var(--row-hover-bg, #e8f0fe);
    border-color: var(--border-color, #d0d8ee);
}

.columns-list-item.dragging {
    opacity: 0.45;
    cursor: grabbing;
}

.columns-list-item input[type="checkbox"] {
    flex-shrink: 0;
    margin: 0;
    cursor: pointer;
}

.columns-list-label {
    display: flex;
    flex-direction: column;
    gap: 1px;
    cursor: pointer;
    min-width: 0;
    flex: 1;
}

.columns-list-label-main {
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.columns-list-label-key {
    font-family: monospace;
    font-size: 0.72rem;
    color: var(--text-muted, #aaa);
    line-height: 1.2;
}

/* -----------------------------------------------------------------------------
   Sidebar — User Note
   ----------------------------------------------------------------------------- */

.sidebar-user-note {
    padding: 16px 12px;
}

.sidebar-user-note p {
    font-size: 0.88rem;
    color: var(--text-muted, #888);
    line-height: 1.5;
    margin: 0;
}

/* -----------------------------------------------------------------------------
   Dark Mode
   ----------------------------------------------------------------------------- */

body.dark-mode .column-pill {
    background: #1a2f4a;
    color: #7eb8f7;
}

body.dark-mode .sidebar-search {
    background: #2a2a2a;
    color: #ddd;
    border-color: #444;
}

body.dark-mode .columns-list-item:hover,
body.dark-mode .columns-list-item[draggable="true"]:hover {
    background: #2e2e3e;
    border-color: #444;
}

/* Category and actions boxes */
body.dark-mode .category-section {
    background: #1e1e1e;
    border-color: #3a3a3a;
}

body.dark-mode .form-actions-section {
    background: #1e1e1e;
    border-color: #3a3a3a;
}

/* Status messages in dark mode */
body.dark-mode .submit-status-text.success {
    color: #6fcf8a !important;
    background: #0d2e18 !important;
    border-color: #1e5c30 !important;
}

body.dark-mode .submit-status-text.error {
    color: #f4a0a0 !important;
    background: #2e0d0d !important;
    border-color: #5c1e1e !important;
}

body.dark-mode .submit-status-text.warning {
    color: #f0cc80 !important;
    background: #2a2000 !important;
    border-color: #5a4400 !important;
}

/* Mode tabs in dark mode */
body.dark-mode .mode-tabs {
    border-bottom-color: #3a3a3a;
}

body.dark-mode .mode-tab {
    color: #888;
}

body.dark-mode .mode-tab:hover {
    color: #ddd;
}

body.dark-mode .mode-tab.active {
    color: #7eb8f7;
    border-bottom-color: #7eb8f7;
}

/* Sidebar config header and footer */
body.dark-mode .sidebar-config-footer {
    border-top-color: #3a3a3a;
}

body.dark-mode .sidebar-config-hint {
    color: #666;
}

body.dark-mode .columns-list-label-key {
    color: #666;
}