:root {
    --bg-dark: #0f1115;
    --bg-panel: #1e1f26;
    --bg-input: #2a2c36;
    --text-main: #f0f1f5;
    --text-muted: #8b8e99;
    --primary: #5865F2;
    /* Discord blurple */
    --primary-hover: #4752C4;
    --success: #3ba55c;
    --success-hover: #2d8046;
    --danger: #ed4245;
    --danger-hover: #c93537;
    --border: #363945;
    --border-focus: #5865F2;
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    padding: 2rem;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

/* Header */
header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #fff;
    letter-spacing: -0.5px;
}

.subtitle h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.subtitle p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* Add Account Section */
.add-account-section {
    background-color: var(--bg-panel);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.add-account-section label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.input-group {
    display: flex;
    gap: 1rem;
}

input[type="text"],
input[type="number"],
select,
textarea {
    flex: 1;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.2);
}

.readonly-input {
    background-color: rgba(42, 44, 54, 0.5) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--border);
}

.btn-danger {
    background-color: transparent;
    color: var(--danger);
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-danger:hover {
    background-color: rgba(237, 66, 69, 0.1);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: var(--success-hover);
}


/* Table */
.accounts-list {
    background-color: var(--bg-panel);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    background-color: rgba(42, 44, 54, 0.3);
}

td {
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

.status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    background-color: rgba(59, 165, 92, 0.15);
    color: var(--success);
    display: inline-block;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--bg-panel);
    border-radius: 12px;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh;
    overflow-y: auto;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.25rem;
}

.close-btn {
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-main);
}

.modal-content form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
    position: relative;
    /* For dropdowns */
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .half {
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* Custom Dropdown (for searchable combobox) */
.custom-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.custom-dropdown.hidden {
    display: none;
}

.dropdown-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.1s;
}

.dropdown-item:hover {
    background-color: var(--border);
}

/* Cards Grid */
.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.task-card {
    background-color: #1a1c22;
    border: 1px solid #2a2c36;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.15rem;
}

.badge-autopost {
    background-color: rgba(59, 130, 246, 0.12);
    color: #4ea8ff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-active {
    background-color: #3ba55c;
    box-shadow: 0 0 8px rgba(59, 165, 92, 0.6);
}

.dot-stopped {
    background-color: #72767d;
}

.task-card-channel {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.channel-icon {
    font-size: 1rem;
    color: var(--text-muted);
}

.channel-hash {
    color: #a77be6;
    background-color: rgba(167, 123, 230, 0.3);
    padding: 0 0.3rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.channel-name {
    color: #fff;
    word-break: break-all;
}

.task-card-server,
.task-card-user {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.task-card-server {
    color: #8c9bb7;
}

.task-card-message {
    background-color: #21232b;
    padding: 1rem;
    border-radius: 8px;
    color: #adb2c5;
    font-style: italic;
    font-size: 0.9rem;
    border: 1px solid #2a2c36;
    margin: 0.2rem 0;
    word-break: break-word;
    min-height: 80px;
    display: flex;
    align-items: center;
}

.task-card-stats {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #2a2c36;
    border-bottom: 1px solid #2a2c36;
    padding: 0.8rem 0;
    margin: 0.2rem 0;
}

.stat-col {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 800;
    letter-spacing: 0.8px;
}

.stat-value {
    font-size: 0.85rem;
    color: #fff;
    font-weight: 700;
}

.task-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.2rem;
}

.btn-action-toggle {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 1rem;
    gap: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
    height: 40px;
}

.btn-toggle-start {
    background-color: transparent;
    color: #3ba55c;
    border: 1px solid rgba(59, 165, 92, 0.4);
}

.btn-toggle-start:hover {
    background-color: rgba(59, 165, 92, 0.1);
    border: 1px solid #3ba55c;
}

.btn-toggle-stop {
    background-color: rgba(227, 132, 38, 0.05);
    color: #e38426;
    border: 1px solid rgba(227, 132, 38, 0.4);
}

.btn-toggle-stop:hover {
    background-color: rgba(227, 132, 38, 0.15);
    border: 1px solid #e38426;
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.btn-icon:hover {
    background-color: #2a2c36;
}

.btn-delete {
    border: 1px solid rgba(237, 66, 69, 0.3);
}

.btn-delete:hover {
    background-color: rgba(237, 66, 69, 0.1);
    border-color: #ed4245;
}