/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f5f6fa;
    color: #2d3436;
    line-height: 1.6;
}

/* ── Navbar ──────────────────────────────────────────────────────────────── */
.navbar {
    background: #2d3436;
    color: #fff;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-brand {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-links a {
    color: #dfe6e9;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: #fff;
}

.nav-user {
    color: #74b9ff;
    font-size: 13px;
    font-weight: 500;
}

.nav-logout {
    color: #ff7675 !important;
}

/* ── Container ───────────────────────────────────────────────────────────── */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

/* ── Flash Messages ──────────────────────────────────────────────────────── */
.flash-messages {
    margin-bottom: 20px;
}

.flash {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.flash-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.flash-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ── Login Page ──────────────────────────────────────────────────────────── */
.login-container {
    max-width: 380px;
    margin: 80px auto 0;
    background: #fff;
    border-radius: 10px;
    padding: 36px 32px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    text-align: center;
}

.login-container h1 {
    font-size: 22px;
    margin-bottom: 4px;
    color: #2d3436;
}

.login-container h2 {
    font-size: 16px;
    font-weight: 400;
    color: #636e72;
    margin-bottom: 24px;
}

.login-form {
    text-align: left;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-section {
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background: #fff;
}

.form-section legend {
    font-weight: 600;
    font-size: 15px;
    padding: 0 8px;
    color: #2d3436;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #636e72;
    margin-bottom: 5px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #74b9ff;
    box-shadow: 0 0 0 3px rgba(116, 185, 255, 0.15);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.form-select {
    cursor: pointer;
}

.checkbox-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 6px;
    font-size: 14px !important;
    font-weight: 400 !important;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-group {
    margin-top: 4px;
}

.checkbox-group label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-weight: 400 !important;
    cursor: pointer;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 6px;
    margin-top: 8px;
}

.input-small {
    width: 140px !important;
    display: inline-block !important;
    padding: 5px 8px !important;
    font-size: 13px !important;
}

.form-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.inline-form {
    display: inline-block;
    margin-right: 6px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: #0984e3;
    color: #fff;
}

.btn-primary:hover {
    background: #0773c5;
}

.btn-secondary {
    background: #b2bec3;
    color: #fff;
}

.btn-secondary:hover {
    background: #636e72;
}

.btn-danger {
    background: #d63031;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: #e17055;
    color: #fff;
}

.btn-warning:hover {
    background: #d63031;
}

.btn-small {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
}

.btn-full {
    width: 100%;
}

/* ── Collapsible Sections ────────────────────────────────────────────────── */
.collapsible-header {
    cursor: pointer;
    user-select: none;
}

.collapsible-header:hover {
    color: #0984e3;
}

.collapsible-body {
    padding-top: 12px;
}

/* ── Status Badges ───────────────────────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-pending {
    background: #ffeaa7;
    color: #2d3436;
}

.status-running {
    background: #74b9ff;
    color: #fff;
}

.status-completed {
    background: #00b894;
    color: #fff;
}

.status-failed {
    background: #d63031;
    color: #fff;
}

/* ── Task Info ───────────────────────────────────────────────────────────── */
.task-info {
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    border: 1px solid #dfe6e9;
}

.task-info p {
    margin-bottom: 6px;
    font-size: 14px;
}

.task-info code {
    background: #f5f6fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

/* ── Log Output ──────────────────────────────────────────────────────────── */
.log-container {
    margin-bottom: 20px;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.log-header h2 {
    font-size: 16px;
}

.log-output {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 16px;
    border-radius: 8px;
    font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    max-height: 600px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ── Admin Panel ─────────────────────────────────────────────────────────── */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
    margin-top: 20px;
}

.admin-panel {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #dfe6e9;
}

.admin-panel h2 {
    font-size: 16px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dfe6e9;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.user-table th {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 2px solid #dfe6e9;
    color: #636e72;
    font-weight: 600;
}

.user-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f5f6fa;
}

.action-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.badge-admin {
    background: #e17055;
    color: #fff;
}

.badge-user {
    background: #dfe6e9;
    color: #2d3436;
}

/* ── Headings ────────────────────────────────────────────────────────────── */
h1 {
    font-size: 24px;
    margin-bottom: 20px;
}

/* ── Small text ──────────────────────────────────────────────────────────── */
small {
    color: #636e72;
    font-size: 12px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }

    .nav-links {
        gap: 10px;
    }
}