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

:root {
    --bg-base: #000000;
    --bg-card: #0a0a0a;
    --bg-input: #111111;
    --border-soft: #222222;
    --border-hover: #333333;
    --text-main: #ededed;
    --text-muted: #888888;
    --primary: #ffffff;
    --primary-text: #000000;
    --accent: #3291ff;
    --radius: 8px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.background-blobs {
    display: none; /* Removed for minimalistic look */
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 3rem 2rem;
    z-index: 1;
    transition: max-width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.container.full-width {
    max-width: 96vw;
}

header {
    margin-bottom: 3.5rem;
    text-align: left;
    animation: fadeIn 0.8s ease-out;
}

.mapping-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.icon {
    font-size: 1.8rem;
    filter: brightness(1.2);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

h1 {
    font-family: 'Outfit', var(--font-sans);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--text-main);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.6s ease-out;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 0px;
}

.tab-btn {
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--text-main);
    border-bottom: 2px solid var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.6rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
}

input[type="text"], input[type="url"], input[type="number"], select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
}

select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23888888%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem top 50%;
    background-size: 0.65rem auto;
    padding-right: 2.5rem;
}

input[type="text"]:focus, input[type="url"]:focus, input[type="number"]:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.input-with-action {
    display: flex;
    gap: 0.5rem;
}

.input-with-action input {
    flex: 1;
}

.btn-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.btn-icon:hover {
    border-color: var(--border-hover);
}

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

.btn-primary {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary);
    color: var(--primary-text);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-primary:hover {
    opacity: 0.9;
}

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

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Robust Mapping Results Layout */
#mapping-results-container {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-soft);
}

.resource-list {
    display: block !important;
    max-height: 500px;
    overflow-y: auto;
    margin-top: 1.5rem;
}

.resource-group {
    background: #0d0d0d;
    border: 1px solid #222;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    display: block !important;
}

.group-header {
    background: #1a1a1a;
    padding: 10px 15px;
    border-bottom: 1px solid #222;
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-title {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}

.resource-item {
    padding: 12px 15px;
    border-bottom: 1px solid #1a1a1a;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
}

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

.resource-link {
    color: #ffffff !important;
    font-size: 13px;
    text-decoration: none;
    word-break: break-all;
    flex: 1;
    display: block;
    line-height: 1.5;
}

/* Custom Checkbox */
.custom-checkbox {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 4px;
    border: 1px solid var(--border-soft);
    background: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.custom-checkbox.checked {
    background: var(--primary);
    border-color: var(--primary);
}

.custom-checkbox svg {
    width: 12px;
    height: 12px;
    color: var(--primary-text);
    display: none;
}

.custom-checkbox.checked svg {
    display: block;
}


/* Status UI */
#status-container {
    margin-top: 2rem;
}

.status-card {
    background: transparent;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.status-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

#status-message {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 4px;
    background: var(--border-soft);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.4s ease;
}

footer {
    margin-top: 4rem;
    text-align: left;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-soft);
    padding-top: 2rem;
}

.hidden {
    display: none !important;
}

/* Custom Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border-soft);
    transition: .3s;
    border-radius: 20px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--primary);
}
input:checked + .slider:before {
    transform: translateX(16px);
    background-color: var(--primary-text);
}

/* Secondary Button */
.btn-secondary {
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover {
    background: var(--border-soft);
    border-color: var(--text-muted);
}

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: transparent !important;
    border-color: var(--border-soft) !important;
    color: var(--text-muted) !important;
    pointer-events: none;
}

/* Table Enhancements */
tbody tr:hover {
    background: rgba(255, 255, 255, 0.02) !important;
}

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

.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    flex-shrink: 0; /* Prevents shrinking */
}

/* Ensure white track on dark buttons */
.btn-primary[disabled] .loader,
.crawl-btn[disabled] .loader {
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: currentColor;
}

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

/* Groups Dashboard */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.group-card {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.group-card:hover {
    transform: translateY(-5px);
    border-color: #3b82f6;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

.group-card h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: #fff;
}

.group-progress {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 1.5rem;
}

.group-card .btn-primary {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    margin-top: 1rem;
    font-size: 0.875rem;
    padding: 0.625rem;
}

.group-card .btn-primary:hover {
    background: #2563eb;
}

.group-card .btn-primary:disabled {
    background: #1e293b;
    border-color: #1e293b;
    cursor: wait;
}

.group-items {
    max-height: 250px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-soft) transparent;
}

.group-items::-webkit-scrollbar {
    width: 6px;
}

.group-items::-webkit-scrollbar-thumb {
    background-color: var(--border-soft);
    border-radius: 10px;
}

/* ═══ Group Crawl Modal ═══ */
.gcm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.gcm-overlay.hidden {
    display: none;
}

.gcm-box {
    background: #0d0d0d;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,0.6);
    position: relative;
    min-height: 200px; /* Ensure a minimum size */
}

.gcm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.gcm-header span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.gcm-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.25rem;
    transition: color 0.2s;
}
.gcm-close-btn:hover { color: var(--text-main); }

#gcm-picker, #gcm-progress-container {
    display: flex;
    flex-direction: column;
    min-height: 0; /* Crucial for flex scrolling */
}

#gcm-progress-container {
    flex: 1;
    overflow: hidden; /* Contains the scrollable list */
}

.gcm-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.75rem 1.5rem 0.5rem;
    flex-shrink: 0;
}

.gcm-overall-bar {
    margin: 0 1.5rem 0;
    height: 4px;
    background: var(--border-soft);
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.gcm-overall-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.gcm-overall-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.4rem 1.5rem 0.75rem;
    flex-shrink: 0;
}

.gcm-url-list {
    overflow-y: auto;
    flex: 1;
    padding: 0.5rem 1.5rem;
    min-height: 0; /* Ensures it can shrink and scroll */
    scrollbar-width: thin;
    scrollbar-color: var(--border-hover) transparent;
}

.gcm-url-list::-webkit-scrollbar { width: 6px; }
.gcm-url-list::-webkit-scrollbar-track { background: transparent; }
.gcm-url-list::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 10px; }
.gcm-url-list::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.gcm-url-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid #111;
    font-size: 0.78rem;
}

.gcm-url-row:last-child { border-bottom: none; }

.gcm-url-text {
    flex: 1;
    color: var(--text-muted);
    word-break: break-all;
    line-height: 1.4;
}

.gcm-status-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 50%;
    background: var(--border-soft);
    transition: background 0.3s;
}

.gcm-status-dot.pending  { background: #333; }
.gcm-status-dot.crawling { background: var(--accent); animation: pulse-dot 1s ease-in-out infinite; }
.gcm-status-dot.done     { background: #22c55e; }
.gcm-status-dot.failed   { background: #ef4444; }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.8); }
}

.gcm-status-label {
    font-size: 0.7rem;
    min-width: 56px;
    text-align: right;
    color: var(--text-muted);
}
.gcm-status-label.crawling { color: var(--accent); }
.gcm-status-label.done     { color: #22c55e; }
.gcm-status-label.failed   { color: #ef4444; }

.gcm-actions {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-soft);
    flex-shrink: 0;
}

/* Pagination Controls */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-soft);
    margin-top: 1rem;
}

.pagination-btn {
    padding: 0.5rem 0.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    color: var(--text-main);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.pagination-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ═══ Enhanced Group Crawl Modal Styles ═══ */

.gcm-config-panel {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.5rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.gcm-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gcm-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    display: block;
}

.gcm-select {
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.2s ease;
}

.gcm-select:hover {
    border-color: var(--border-hover);
}

.gcm-select:focus {
    outline: none;
    border-color: var(--accent);
    background: #131313;
}

.gcm-format-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
}

.gcm-format-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.gcm-format-option input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

.gcm-format-option:has(input:checked) {
    background: #1a1a2e;
    border-color: var(--accent);
}

.gcm-format-option:hover {
    border-color: var(--border-hover);
    background: #131313;
}

.gcm-format-label {
    font-size: 0.9rem;
    color: var(--text-main);
    flex: 1;
}

.gcm-info-box {
    padding: 1rem;
    background: #0f1419;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
}

.gcm-config-actions {
    padding-top: 0.5rem;
}

.gcm-progress-header {
    padding: 1rem 1.5rem 0.5rem;
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.gcm-progress-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.gcm-progress-status {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.gcm-success-message {
    padding: 1rem 0;
    text-align: center;
    border-bottom: 1px solid var(--border-soft);
}

.gcm-success-message p {
    font-size: 0.95rem;
    color: #22c55e;
}

/* Make modal scrollable while preserving header/footer */
.gcm-box {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#gcm-config-panel, #gcm-progress-container {
    min-height: 300px;
}

/* ═══ Group Links Modal ═══ */

.glm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: glmFadeIn 0.25s ease-out;
}

.glm-overlay.hidden {
    display: none !important;
}

@keyframes glmFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes glmSlideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.glm-box {
    background: #0c0c0c;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    width: 100%;
    max-width: 640px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255,255,255,0.04);
    animation: glmSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.glm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
    gap: 1rem;
}

.glm-header-info {
    flex: 1;
    min-width: 0;
}

.glm-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.glm-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.3rem 0 0;
}

.glm-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.glm-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.glm-close-btn:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.06);
}

.glm-search {
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.glm-search input {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.glm-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.glm-search input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.glm-url-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-hover) transparent;
}

.glm-url-list::-webkit-scrollbar { width: 6px; }
.glm-url-list::-webkit-scrollbar-track { background: transparent; }
.glm-url-list::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 10px; }
.glm-url-list::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.glm-url-row {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1.5rem;
    transition: background 0.15s ease;
    cursor: pointer;
}

.glm-url-row:hover {
    background: rgba(255, 255, 255, 0.025);
}

.glm-url-row .custom-checkbox {
    flex-shrink: 0;
}

.glm-url-index {
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.5;
    min-width: 24px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.glm-url-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-main);
    word-break: break-all;
    line-height: 1.5;
    opacity: 0.88;
}

.glm-url-external {
    flex-shrink: 0;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.15s;
    text-decoration: none;
    font-size: 0.75rem;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
}

.glm-url-row:hover .glm-url-external {
    opacity: 0.6;
}

.glm-url-external:hover {
    opacity: 1 !important;
    color: var(--accent);
    background: rgba(50, 145, 255, 0.08);
}

.glm-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    opacity: 0.7;
}

.glm-footer {
    padding: 0.875rem 1.5rem;
    border-top: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.glm-selection-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Discovery Log Panel
   ═══════════════════════════════════════════════════════════════════════════════ */

.discovery-log {
    margin-top: 1.5rem;
    background: rgba(8, 12, 24, 0.85);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    overflow: hidden;
    animation: dlFadeIn 0.35s ease;
}

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

.discovery-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem 0.75rem;
}

.discovery-log-title-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.discovery-log-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6366f1;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
    animation: dlPulse 1.5s ease-in-out infinite;
}

.discovery-log-dot.done {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
    animation: none;
}

@keyframes dlPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.5; transform: scale(0.85); }
}

#discovery-log-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.discovery-log-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.12);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(99, 102, 241, 0.15);
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
}

.discovery-log-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.05);
    margin: 0 1.25rem;
    border-radius: 3px;
    overflow: hidden;
}

.discovery-log-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #818cf8);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.discovery-log-fill.indeterminate {
    width: 30% !important;
    animation: dlIndeterminate 1.8s ease-in-out infinite;
}

@keyframes dlIndeterminate {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

.discovery-log-messages {
    max-height: 220px;
    overflow-y: auto;
    padding: 0.75rem 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}

.discovery-log-messages::-webkit-scrollbar {
    width: 5px;
}

.discovery-log-messages::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 5px;
}

.dl-msg {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.78rem;
    line-height: 1.65;
    color: rgba(226, 232, 240, 0.7);
    display: flex;
    align-items: baseline;
    gap: 0.625rem;
    animation: dlMsgIn 0.2s ease;
}

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

.dl-msg-time {
    color: rgba(148, 163, 184, 0.45);
    font-size: 0.7rem;
    flex-shrink: 0;
    min-width: 52px;
}

.dl-msg-text {
    flex: 1;
    word-break: break-word;
}

.dl-msg-count {
    color: #818cf8;
    font-weight: 600;
    flex-shrink: 0;
    font-size: 0.72rem;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Group Crawl Terminal UI
   ═══════════════════════════════════════════════════════════════════════════════ */
.gcm-terminal-container {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 1.5rem;
    font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
    color: #c9d1d9;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    position: relative;
}

.gcm-terminal-header {
    background: #161b22;
    border-bottom: 1px solid #30363d;
    padding: 0.6rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #8b949e;
}

.gcm-terminal-title {
    font-weight: 600;
    color: #c9d1d9;
}

.gcm-terminal-stats {
    display: flex;
    gap: 1.25rem;
}

.gcm-terminal-body {
    padding: 0.75rem;
    height: 250px;
    overflow-y: auto;
    font-size: 0.8rem;
    line-height: 1.5;
    position: relative;
}

.gcm-terminal-body::-webkit-scrollbar {
    width: 8px;
}
.gcm-terminal-body::-webkit-scrollbar-track {
    background: #0d1117;
}
.gcm-terminal-body::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

.log-line {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.35rem;
    word-break: break-word;
}

.log-time {
    color: #8b949e;
    flex-shrink: 0;
    font-size: 0.7rem;
    padding-top: 0.1rem;
}

.log-icon {
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

.log-content {
    flex: 1;
    white-space: pre-wrap;
}

.log-info { color: #c9d1d9; }
.log-success { color: #3fb950; }
.log-warning { color: #d29922; }
.log-error { color: #f85149; }
.log-processing { color: #bc8cff; }

.log-url {
    color: #58a6ff;
    text-decoration: underline;
    text-decoration-color: rgba(88, 166, 255, 0.4);
}

.log-url:hover {
    text-decoration-color: #58a6ff;
}

/* Jump to latest button */
.gcm-jump-btn {
    position: absolute;
    bottom: 1rem;
    right: 1.5rem;
    background: rgba(33, 38, 45, 0.95);
    border: 1px solid #30363d;
    color: #c9d1d9;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 10;
    transition: opacity 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.gcm-jump-btn:hover {
    background: #30363d;
    transform: translateY(-1px);
}
.gcm-jump-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

/* ============================================================
   GROUP CRAWL MODAL - DASHBOARD LAYOUT
   ============================================================ */
.gcm-box.gcm-dashboard-layout {
    max-width: 1280px;
    width: 95vw;
    height: 92vh;
    max-height: 92vh;
    background: #09090b;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gcm-header-titles {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.gcm-title-large {
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    color: #fff;
    letter-spacing: -0.01em;
}

.gcm-dashboard-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1rem;
    padding: 1rem;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: #09090b;
    flex: 1;
}

.gcm-dashboard-left {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.gcm-dashboard-right {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.gcm-progress-dashboard {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    height: 100%;
}

/* Cards */
.gcm-card {
    background: #111113;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    position: relative;
}

.gcm-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-soft);
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #161618;
    border-radius: 8px 8px 0 0;
}

.gcm-card-body {
    padding: 1.25rem;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Override existing styles for cards */
.gcm-summary-card {
    flex-shrink: 0;
}

.gcm-summary-card .gcm-card-body {
    padding: 0.85rem 1.25rem;
    justify-content: center;
}

.gcm-summary-card .gcm-overall-bar {
    margin: 0;
    height: 6px;
    background: #222;
}

.gcm-summary-card .gcm-overall-label {
    padding: 0.6rem 0 0 0;
    font-size: 0.85rem;
    text-align: center;
    color: #a1a1aa;
}

.gcm-urls-card {
    flex: 1.5;
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.gcm-urls-card .gcm-card-body {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.gcm-urls-card .gcm-url-list {
    padding: 0.5rem 1rem;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.gcm-batches-card {
    flex: 1.5;
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.gcm-batches-card .gcm-card-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.gcm-batches-card #gcm-batch-list {
    flex: 1;
    overflow-y: auto;
    max-height: none !important;
}

.gcm-url-row {
    padding: 0.85rem 0;
    border-bottom: 1px solid #1f1f22;
    gap: 1rem;
    align-items: flex-start;
}

.gcm-status-dot {
    margin-top: 4px;
    width: 12px;
    height: 12px;
    min-width: 12px;
}

.gcm-url-text {
    font-size: 0.85rem;
    color: #d4d4d8;
    line-height: 1.5;
}

.gcm-status-label {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Terminal / Logs Card */
.gcm-logs-card {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.gcm-logs-card .gcm-card-body {
    padding: 0;
    background: #0d1117;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.gcm-logs-card .gcm-terminal-header {
    background: #161b22;
    border-bottom: 1px solid #30363d;
    border-radius: 8px 8px 0 0;
    padding: 0.75rem 1.25rem;
}

.gcm-logs-card .gcm-terminal-title {
    color: #fff;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.gcm-logs-card .gcm-terminal-body {
    padding: 1rem 1.25rem;
    font-size: 0.85rem;
    line-height: 1.6;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    max-height: none;
}

/* Success Card */
.gcm-actions {
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

.gcm-success-card {
    align-items: center;
    text-align: center;
    padding: 3rem;
    width: 100%;
    max-width: 500px;
    border-color: #22c55e33;
    background: linear-gradient(180deg, #111113 0%, #0a1510 100%);
}

.gcm-success-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.gcm-success-card h3 {
    color: #fff;
    font-size: 1.4rem;
    margin: 0 0 1rem;
}

.gcm-success-details {
    color: #a1a1aa;
    line-height: 1.6;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

