:root {
    --primary: #6c63ff;
    --secondary: #ff6584;
    --dark-bg: #0f0c29;
    --gradient: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    --glass: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);
    --text: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--gradient);
    background-attachment: fixed;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text);
    overflow: hidden;
}

.glass-container {
    width: 95%;
    max-width: 1100px;
    height: 92vh;
    background: var(--glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 30px;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 15px;
}

.logo h1 { font-size: 1.8rem; font-weight: 600; letter-spacing: -1px; }
.logo span {
    color: var(--primary);
    background: linear-gradient(to right, #6c63ff, #ff6584);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
header p { color: var(--text-dim); font-weight: 300; font-size: 0.85rem; }

main {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 20px;
    flex-grow: 1;
    overflow: hidden;
}

.config-pane {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding-right: 8px;
}

.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.input-group { display: flex; flex-direction: column; gap: 4px; }
.input-group label { font-size: 0.75rem; color: var(--text-dim); margin-left: 5px; }

input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 10px;
    color: white;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(108, 99, 255, 0.3);
}

.custom-area-input {
    display: flex;
    gap: 5px;
    margin-bottom: 8px;
}
.custom-area-input input {
    flex-grow: 1;
}
.custom-area-input button {
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: white;
    padding: 0 15px;
    cursor: pointer;
    transition: 0.3s;
}
.custom-area-input button:hover {
    background: var(--secondary);
}

/* District Picker */
.picker-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    min-height: 80px;
    max-height: 140px;
    padding: 8px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.picker-placeholder { color: var(--text-dim); font-size: 0.8rem; width: 100%; text-align: center; margin-top: 10px; }

.tag {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: 0.2s;
}
.tag:hover { background: rgba(255, 255, 255, 0.2); }
.tag.selected { background: var(--primary); border-color: var(--primary); }
.tag.all-btn { background: var(--secondary); border-color: var(--secondary); font-weight: 600; }

button#startBtn {
    margin: 5px 0;
    padding: 10px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(to right, #6c63ff, #4a3aff);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* History Section */
.history-section { border-top: 1px solid var(--border); padding-top: 15px; margin-top: 10px; }
.history-section h3 { font-size: 0.9rem; margin-bottom: 10px; color: var(--text-dim); }

.history-list { display: flex; flex-direction: column; gap: 8px; max-height: 250px; overflow-y: auto; padding-right: 5px; }

.history-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: 0.3s;
}
.history-item:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--primary); }

.history-info { display: flex; flex-direction: column; gap: 2px; }
.history-name { font-size: 0.85rem; font-weight: 600; }
.history-date { font-size: 0.7rem; color: var(--text-dim); }

.history-actions { display: flex; gap: 8px; }
.action-btn { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 0.9rem; transition: 0.2s; }
.action-btn:hover { color: white; }
.action-btn.del:hover { color: var(--secondary); }

.monitor-pane {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 20px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: hidden;
}

.status-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 15px;
    border: 1px solid var(--border);
}

.status-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.badge { padding: 2px 8px; border-radius: 5px; font-size: 0.65rem; font-weight: 600; }
.badge.idle { background: #333; }
.badge.active { background: #6c63ff; animation: pulse 2s infinite; }
.badge.done { background: #2ecc71; }

#statusMsg { font-size: 0.8rem; color: var(--text-dim); }

.progress-bar-container { height: 5px; background: rgba(0, 0, 0, 0.3); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.progress-fill { height: 100%; background: linear-gradient(to right, #6c63ff, #ff6584); transition: width 0.5s ease; }

.results-summary { display: flex; justify-content: space-between; align-items: center; }
.summary-item span { font-size: 1.6rem; font-weight: 600; }
.summary-item label { font-size: 0.75rem; color: var(--text-dim); }

.btn-group { display: flex; gap: 5px; }
.download-btn { padding: 6px 10px; border-radius: 6px; border: none; color: white; font-size: 0.7rem; font-weight: 600; cursor: pointer; }
.download-btn.csv { background: #3498db; }
.download-btn.excel { background: #2ecc71; }
.download-btn.json { background: #f1c40f; color: #333; }

.log-container {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 12px;
    overflow-y: auto;
    font-size: 0.8rem;
    border: 1px solid var(--border);
}

.log-entry { margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.log-entry .name { color: var(--primary); font-weight: 600; }

footer { margin-top: 10px; text-align: center; font-size: 0.7rem; color: var(--text-dim); }

.loading-pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }

/* Responsive Mobile Tweaks */
@media (max-width: 768px) {
    body {
        height: auto;
        overflow-y: auto;
        padding: 10px 0;
        align-items: flex-start;
    }

    .glass-container {
        width: 100%;
        height: auto;
        min-height: 100vh;
        border-radius: 0;
        padding: 15px;
        margin: 0;
        border: none;
    }

    main {
        grid-template-columns: 1fr;
        gap: 30px;
        overflow: visible;
    }

    .config-pane {
        overflow-y: visible;
        padding-right: 0;
    }

    .monitor-pane {
        height: 600px; /* Fixed height for results on mobile to allow internal scroll */
    }

    .input-row {
        grid-template-columns: 1fr;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .summary-item span {
        font-size: 1.3rem;
    }
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
