:root {
    --bg-color: #0d1117;
    --panel-bg: rgba(22, 27, 34, 0.6);
    --border-color: rgba(255, 255, 255, 0.1);
    --accent-primary: #7d5fff;
    --accent-secondary: #00d2ff;
    --text-main: #e6edf3;
    --text-dim: #8b949e;
    --glass-blur: blur(12px);
    --neon-glow: 0 0 15px rgba(125, 95, 255, 0.3);
}

html {
    height: 100%;
    background: var(--bg-color);
}

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

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    min-height: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

main {
    flex: 1;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    padding: 0 1.5rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-nav {
    display: flex;
    gap: .5rem;
}

.nav-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.6rem 0.5rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover {
    border-color: rgba(125, 95, 255, 0.5);
    color: var(--text-main);
    background: rgba(125, 95, 255, 0.05);
}

.nav-link.active {
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, rgba(125, 95, 255, 0.45), rgba(0, 210, 255, 0.28));
    border: 1px solid rgba(195, 175, 255, 0.95);
    box-shadow:
        0 0 0 2px rgba(125, 95, 255, 0.35),
        0 0 22px rgba(125, 95, 255, 0.55),
        0 0 44px rgba(0, 210, 255, 0.22);
}

.nav-link.active:hover {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(125, 95, 255, 0.52), rgba(0, 210, 255, 0.32));
    border-color: #d4c8ff;
    box-shadow:
        0 0 0 2px rgba(125, 95, 255, 0.45),
        0 0 28px rgba(125, 95, 255, 0.65),
        0 0 52px rgba(0, 210, 255, 0.28);
}

/* Page Layouts */
.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: .5rem .5rem;
    height: calc(100vh - 72px);
    overflow: hidden;
}

.page-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    flex: 1;
    height: 100%;
    min-height: 0;
}

/* 160px Ad Sidebar Layout */
.page-with-ads {
    display: flex;
    gap: 1rem;
    flex: 1;
    height: 100%;
    min-height: 0;
    align-items: stretch;
}

.ad-sidebar {
    width: 160px;
    min-width: 160px;
    max-width: 160px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 0.5rem;
    overflow: hidden;
}

.ad-sidebar ins.adsbygoogle {
    display: inline-block;
    width: 160px;
    height: 600px;
}

/* Specific 3-Column + Footer Layout (for Tab 4/5) */
.footer-layout {
    display: flex !important;
    flex-direction: column;
    height: 100%;
}

.tabs-grid-three {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

.action-footer {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.action-footer .btn {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    min-width: 120px;
}

.panel {
    background: var(--panel-bg);
    border: 1px solid rgba(125, 95, 255, 0.35);
    border-radius: 8px;
    backdrop-filter: var(--glass-blur);
    display: flex;
    flex-direction: column;
    padding: .5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(125, 95, 255, 0.12), 0 0 22px rgba(125, 95, 255, 0.16);
    transition: transform 0.3s ease, border-color 0.3s ease;
    height: 100%;
    min-height: 0;
    min-width: 0;
}

.panel:hover {
    border-color: rgba(125, 95, 255, 0.62);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(125, 95, 255, 0.2), 0 0 30px rgba(125, 95, 255, 0.24);
}

.panel-header {
    margin-bottom: .5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
}

.counter {
    font-size: 0.75rem;
    color: var(--accent-secondary);
    background: rgba(0, 210, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

textarea {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    box-shadow: 0 0 0 1px rgba(125, 95, 255, 0.28), 0 0 20px rgba(125, 95, 255, 0.16);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-main);
    font-size: 0.9rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px rgba(125, 95, 255, 0.6), 0 0 26px rgba(125, 95, 255, 0.34);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select {
    box-shadow: 0 0 0 1px rgba(125, 95, 255, 0.26), 0 0 16px rgba(125, 95, 255, 0.16);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px rgba(125, 95, 255, 0.58), 0 0 24px rgba(125, 95, 255, 0.32);
}

.actions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.btn {
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), filter 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: white;
}

.btn-main {
    background: linear-gradient(135deg, #ff7f50, #ff4757);
}

.btn-primary {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
}

.btn-secondary {
    background: linear-gradient(135deg, #00a37a, #3db89a);
    color: #042a22;
}

.btn-secondary:hover {
    color: #021811;
}

.btn-accent {
    background: linear-gradient(135deg, #0984e3, #74b9ff);
    color: #0a0a0a;
}

.btn-accent:hover {
    color: #000000;
}

.btn-danger {
    background: linear-gradient(135deg, #e17055, #fab1a0);
}

.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

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

.btn:disabled {
    opacity: 0.4;
    filter: grayscale(0.6);
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
}

.btn i {
    font-size: 1.1rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.panel {
    animation: fadeIn 0.6s ease-out forwards;
}

.panel:nth-child(2) {
    animation-delay: 0.1s;
}

.panel:nth-child(3) {
    animation-delay: 0.2s;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Make input/output textareas easier to scroll */
textarea {
    scrollbar-width: auto;
    scrollbar-color: rgba(125, 95, 255, 0.75) rgba(255, 255, 255, 0.08);
}

textarea::-webkit-scrollbar {
    width: 12px;
}

textarea::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

textarea::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(125, 95, 255, 0.85), rgba(0, 210, 255, 0.7));
    border-radius: 10px;
    border: 2px solid rgba(13, 17, 23, 0.85);
}

textarea::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(125, 95, 255, 0.95), rgba(0, 210, 255, 0.82));
}

.results-list-container {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
}

.domain-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.domain-row:hover {
    background: rgba(108, 92, 231, 0.08);
    border-color: rgba(108, 92, 231, 0.3);
}

.domain-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.domain-info {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Long domain / zone labels: clip inside row so flex layout does not overflow */
.domain-info .domain-name,
.domain-info>span:first-of-type:not(.domain-count) {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.domain-count {
    flex-shrink: 0;
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent-primary);
    padding: 0.2rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 700;
}

/* --- Panel Search Bar --- */
.panel-search-bar {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.panel-search-bar .search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-dim);
    font-size: 0.8rem;
    pointer-events: none;
    transition: color 0.2s ease;
}

.panel-search-bar input {
    width: 100%;
    padding: 0.45rem 2rem 0.45rem 2.1rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.panel-search-bar input:focus {
    border-color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 0 0 1px rgba(125, 95, 255, 0.58), 0 0 16px rgba(125, 95, 255, 0.25);
}

.panel-search-bar input:focus ~ .search-icon {
    color: var(--accent-primary);
}

.panel-search-bar .clear-search-btn {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    display: none;
    padding: 0.25rem;
    font-size: 0.8rem;
    line-height: 1;
    border-radius: 50%;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.panel-search-bar .clear-search-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

/* --- Progress Overlay --- */
.progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 18, 0.85);
    backdrop-filter: blur(12px);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.progress-overlay.active {
    display: flex;
}

.range-export-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 8, 16, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 1rem;
}

.range-export-overlay[hidden] {
    display: none !important;
}

.range-export-modal {
    width: min(460px, 100%);
    background: linear-gradient(160deg, rgba(20, 24, 38, 0.97), rgba(17, 19, 34, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
    padding: 1rem;
}

.range-export-modal h3 {
    margin: 0 0 0.35rem 0;
    font-size: 1rem;
    color: var(--text-main);
}

.range-export-modal p {
    margin: 0 0 0.8rem 0;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.range-export-modal label {
    display: block;
    margin: 0.5rem 0 0.35rem 0;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.range-export-modal select,
.range-export-modal input {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    padding: 0.55rem 0.65rem;
}

.range-export-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

.range-export-help {
    min-height: 1.2rem;
    margin-top: 0.65rem;
    color: var(--accent-primary);
    font-size: 0.8rem;
}

.range-export-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    margin-top: 0.8rem;
}

.progress-container {
    width: 400px;
    background: rgba(255, 255, 255, 0.05);
    padding: 2.5rem;
    border-radius: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    text-align: center;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-header {
    margin: 0 0 1.25rem;
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.preloader-spinner {
    width: 52px;
    height: 52px;
    margin: 0 auto 1.35rem;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--accent-primary);
    animation: preloader-spin 0.75s linear infinite;
    flex-shrink: 0;
}

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

.progress-status {
    color: var(--text-dim);
    font-size: 1rem;
    line-height: 1.45;
    margin-bottom: 2rem;
    min-height: 1.45em;
}

.btn-cancel {
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
    border: 1px solid rgba(255, 71, 87, 0.3);
    padding: 0.8rem 2rem;
    border-radius: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.3s ease, background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 auto;
}

.btn-cancel:hover {
    background: #ff4757;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 71, 87, 0.4);
}

/* Split List page */
.split-list-page .page-layout>.panel>.panel-header {
    padding-bottom: 0.65rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.split-list-page .panel-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.split-list-page .page-layout {
    grid-template-columns: 1fr 1fr 1fr;
}

.split-list-page .split-file-load-label {
    cursor: pointer;
    background: rgba(125, 95, 255, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(125, 95, 255, 0.3);
    transition: border-color 0.2s ease, filter 0.2s ease;
}

.split-list-page .split-file-load-label:hover {
    border-color: rgba(125, 95, 255, 0.55);
    filter: brightness(1.08);
}

.split-list-page .split-file-load-label.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}


/* Merge List page — matching dual-card headers */
.merge-list-page .page-layout>.panel>.panel-header {
    padding-bottom: 0.65rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.merge-list-page .panel-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.merge-list-page .merge-file-load-label {
    cursor: pointer;
    background: rgba(125, 95, 255, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(125, 95, 255, 0.3);
    transition: border-color 0.2s ease, filter 0.2s ease;
}

.merge-list-page .merge-file-load-label:hover {
    border-color: rgba(125, 95, 255, 0.55);
    filter: brightness(1.08);
}

.split-options-panel .split-options-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.split-section-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin-bottom: 0.35rem;
}

.split-option-group {
    margin-bottom: 1.25rem;
}

.split-option-group label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-main);
    font-size: 0.88rem;
    line-height: 1.45;
    margin-bottom: 0.5rem;
}

.split-option-group input[type="radio"] {
    margin-top: 0.2rem;
    accent-color: var(--accent-primary);
    flex-shrink: 0;
}

.split-input-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.35rem;
}

.split-number-input {
    width: 100%;
    max-width: 280px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
}

.split-number-input:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--neon-glow);
}

/* Merge List page */
.merge-hint {
    font-size: 0.82rem;
    color: var(--text-dim);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.merge-file-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.merge-file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.88rem;
}

.merge-file-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-main);
}

.merge-file-count {
    color: var(--accent-secondary);
    font-size: 0.78rem;
    white-space: nowrap;
}

.merge-file-row button {
    flex-shrink: 0;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid rgba(255, 71, 87, 0.35);
    background: rgba(255, 71, 87, 0.12);
    color: #ff6b81;
    cursor: pointer;
}

.merge-file-row button:hover {
    background: rgba(255, 71, 87, 0.22);
}

/* Ephemeral copy feedback (no alert) */
.copy-toast {
    position: fixed;
    bottom: 1.75rem;
    left: 50%;
    z-index: 20000;
    max-width: min(90vw, 22rem);
    padding: 0.65rem 1.35rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-main);
    background: rgba(22, 27, 34, 0.92);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--neon-glow), 0 8px 32px rgba(0, 0, 0, 0.45);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 12px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.copy-toast.copy-toast--visible {
    opacity: 1;
    transform: translate(-50%, 0);
}