:root {
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --bg-header: #242424;
    --bg-input: #2d2d2d;
    --border-color: #404040;
    
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --text-link: #4facfe;

    --primary-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --success-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --danger-gradient: linear-gradient(135deg, #ff0844 0%, #ffb199 100%);
    --warning-gradient: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.4);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Header */
.header {
    background: var(--bg-header);
    padding: 20px 0;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.header .container {
    padding: 0 20px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header h1 {
    font-size: 24px;
    font-weight: 700;
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

/* Navigation */
.nav { display: flex; gap: 20px; }
.nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}
.nav a:hover, .nav a.active {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

/* Typography */
h1, h2, h3 { margin-bottom: 1rem; color: #fff; }
p { margin-bottom: 1rem; color: var(--text-muted); }
a { color: var(--text-link); text-decoration: none; transition: var(--transition); }
a:hover { filter: brightness(1.2); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.5;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    background: #333;
    color: #fff;
    min-width: 100px;
    min-height: 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

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

.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-success {
    background: var(--success-gradient);
    color: #000; /* Dark text on bright green */
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
}

.btn-danger {
    background: var(--danger-gradient);
    color: #fff;
}

.btn-warning {
    background: var(--warning-gradient);
    color: #000;
}

/* Secondary / Cancel Button */
.btn-secondary, a.btn:not(.btn-success):not(.btn-primary):not(.btn-danger):not(.btn-warning) {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}
.btn-secondary:hover, a.btn:not(.btn-success):not(.btn-primary):not(.btn-danger):not(.btn-warning):hover {
    background: rgba(255,255,255,0.05);
    border-color: #666;
    color: #fff;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
}

/* Forms */
.form-group { margin-bottom: 25px; }
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    color: #fff;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 15px;
    transition: var(--transition);
    outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.2);
    background: #333;
}

/* Custom Checkbox/Radio Styling Wrapper */
.radio-group, .checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}
.radio-label, .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: var(--transition);
}
.radio-label:hover, .checkbox-label:hover {
    background: rgba(255,255,255,0.08);
}
input[type="radio"], input[type="checkbox"] {
    accent-color: #4facfe;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Custom File Input Styling */
.file-input-wrapper {
    position: relative;
    width: 100%;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

.file-input-label {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.file-input-label:hover {
    border-color: rgba(79, 172, 254, 0.5);
    background: #2a2a2a;
}

.file-input-button {
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    transition: var(--transition);
}

.file-input-label:hover .file-input-button {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.file-input-text {
    color: var(--text-muted);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
}


th {
    text-align: left;
    padding: 15px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}
td {
    padding: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 40px;
    white-space: nowrap;
}
.status-running { background: rgba(79, 172, 254, 0.2); color: #4facfe; border: 1px solid rgba(79, 172, 254, 0.3); }
.status-completed { background: rgba(67, 233, 123, 0.2); color: #43e97b; border: 1px solid rgba(67, 233, 123, 0.3); }
.status-failed { background: rgba(255, 8, 68, 0.2); color: #ff0844; border: 1px solid rgba(255, 8, 68, 0.3); }
.status-pending { background: rgba(255, 255, 255, 0.1); color: #aaa; border: 1px solid rgba(255, 255, 255, 0.1); }

/* Domain Results Coloring */
.available { color: #43e97b; } /* Green for available */
.taken { color: #ff0844; } /* Red for taken */
.timeout { color: #fda085; } /* Orange for timeout */

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 24px; /* Increased height */
    background: #333;
    border-radius: 6px;
    overflow: hidden;
    margin: 8px 0;
}
.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px; /* Added horizontal padding for text */
    font-size: 14px; /* Increased font size */
    font-weight: 600;
}

/* Utilities */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: 1rem; }
.my-4 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.gap-2 { gap: 1rem; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

.panel {
    background: var(--bg-header);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border-color);
}

/* Filter Bar */
.filter-bar {
    background: var(--bg-header);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar select,
.filter-bar input[type="number"] {
    flex: 1;
    min-width: 150px; /* Ensure a reasonable minimum width */
    width: auto; /* Override the 100% width from generic form styling */
}

/* Django Tables2 Sorting */
th.orderable a {
    color: var(--text-muted);
    text-decoration: none;
    position: relative;
    padding-right: 15px;
}
th.orderable a:hover {
    color: #fff;
}
th.asc a, th.desc a {
    color: #fff; /* Active sort column */
}
th.asc a::after {
    content: ' ▲';
    font-size: 0.8em;
    position: absolute;
    right: 0;
    top: 2px;
}
th.desc a::after {
    content: ' ▼';
    font-size: 0.8em;
    position: absolute;
    right: 0;
    top: 2px;
}
/* Metrics Layout */
#batch-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    align-items: start;
}

.metric {
    display: flex;
    flex-direction: column;
}

.metric-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.metric-value { font-size: 20px; font-weight: 700; color: #fff; margin-top: 5px; font-variant-numeric: tabular-nums; }

/* Errors */
.errorlist {
    color: #ff0844;
    font-size: 14px;
    margin-top: 5px;
    list-style-type: none;
}
