:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-card: #1e1e1e;
    --bg-hover: #252525;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --accent: #667eea;
    --accent-hover: #5568d3;
    --accent-light: rgba(102, 126, 234, 0.1);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: #2a2a2a;
    --shadow: rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
}

.logo i {
    color: var(--accent);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 15px;
    background: var(--bg-card);
    border-radius: 50px;
    border: 1px solid var(--border);
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Auth Card */
.auth-card {
    max-width: 500px;
    margin: 100px auto;
    background: var(--bg-card);
    border-radius: 24px;
    padding: 40px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px var(--shadow);
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent), #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 14px;
}

/* Navigation Tabs */
.nav-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 8px;
    margin-bottom: 30px;
    border: 1px solid var(--border);
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.nav-tab {
    flex: 1;
    min-width: 120px;
    padding: 14px 20px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.nav-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-tab.active {
    background: linear-gradient(135deg, var(--accent), #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: var(--accent-light);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 24px var(--shadow);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-card);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* Custom Chat Selector */
.chat-selector {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.chat-selector:focus-within {
    border-color: var(--accent);
}

.chat-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-item:last-child {
    border-bottom: none;
}

.chat-item:hover {
    background: var(--bg-hover);
}

.chat-item.selected {
    background: var(--accent-light);
    border-left: 3px solid var(--accent);
}

.chat-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.chat-item.selected .chat-checkbox {
    background: var(--accent);
    border-color: var(--accent);
}

.chat-checkbox i {
    color: white;
    font-size: 12px;
    display: none;
}

.chat-item.selected .chat-checkbox i {
    display: block;
}

.chat-info {
    flex: 1;
}

.chat-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.chat-type {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* Buttons */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

/* File Upload */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.3s;
}

.file-upload-area:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.file-upload-area i {
    font-size: 48px;
    color: var(--accent);
    margin-bottom: 10px;
}

#fileInput,
#editFileInput {
    display: none;
}

/* Image Preview Grid */
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.image-preview-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    cursor: move;
    transition: all 0.3s;
}

.image-preview-item:hover {
    transform: scale(1.05);
    border-color: var(--accent);
    box-shadow: 0 4px 12px var(--shadow);
}

.image-preview-item.dragging {
    opacity: 0.5;
}

.image-preview-item img,
.image-preview-item video {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.image-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent);
    display: flex;
    justify-content: space-between;
    padding: 8px;
}

.image-preview-number {
    background: var(--accent);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.btn-remove-image {
    background: var(--danger);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-remove-image:hover {
    transform: scale(1.1);
}

/* Task List */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.task-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.task-card:hover {
    border-color: var(--accent);
    transform: translateX(4px);
    box-shadow: 0 4px 12px var(--shadow);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.task-name-badge {
    background: var(--accent);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

.task-status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-paused {
    background: rgba(160, 160, 160, 0.2);
    color: var(--text-secondary);
}

.status-archived {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.task-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.task-body {
    margin-bottom: 12px;
}

.task-message {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 15px;
    line-height: 1.5;
}

.task-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 13px;
}

.task-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.task-meta-item i {
    color: var(--accent);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 30px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px var(--shadow);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Info Box */
.info-box {
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.info-box i {
    color: var(--accent);
    font-size: 20px;
}

.info-box-text {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Alert */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-info {
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid var(--accent);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 56px;
    height: 32px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    transition: 0.4s;
    border-radius: 32px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background: var(--accent);
    border-color: var(--accent);
}

input:checked+.toggle-slider:before {
    transform: translateX(24px);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-info h3 {
    font-size: 15px;
    margin-bottom: 4px;
}

.setting-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Loader */
.loader {
    border: 3px solid var(--bg-secondary);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

/* Admin Panel Styles */
.user-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.user-list-item {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
}
.user-list-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}
.user-info strong {
    font-size: 15px;
}
.user-info span {
    color: var(--text-secondary);
    font-size: 13px;
}
.admin-badge {
    background: var(--warning);
    color: white;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 700;
    margin-left: 8px;
    text-transform: uppercase;
}
.user-meta {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Language Switcher Styles */
.lang-switcher {
    display: flex;
    gap: 5px;
    align-items: center;
    margin-right: 15px;
}
.lang-switcher button {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-weight: 700;
    width: 40px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}
.lang-switcher button:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}
.lang-switcher button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Account Dropdown Styles */
.user-badge-clickable {
    cursor: pointer;
    position: relative;
}
.account-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 280px;
    box-shadow: 0 10px 30px var(--shadow);
    z-index: 100;
    overflow: hidden;
    animation: fadeIn 0.2s;
}
.account-dropdown.active {
    display: block;
}
.user-badge-clickable.active .fa-chevron-down {
    transform: rotate(180deg);
}
.account-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    transition: background 0.2s;
    cursor: pointer;
}
.account-item:hover {
    background: var(--bg-hover);
}
.account-item .user-avatar {
    width: 40px;
    height: 40px;
    font-size: 16px;
}
.account-item-info strong {
    display: block;
    color: var(--text-primary);
}
.account-item-info span {
    font-size: 12px;
    color: var(--text-secondary);
}
.account-item .active-indicator {
    margin-left: auto;
    color: var(--success);
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.2s;
}
.account-item.current .active-indicator {
    opacity: 1;
}
.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}
.dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}
.dropdown-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.dropdown-btn.add-account {
    color: var(--accent);
}
.dropdown-btn.logout {
    color: var(--danger);
}


/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-end; /* Align to the right */
    }

    .nav-container {
        flex-wrap: wrap;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .task-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .image-preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/* New Styles for Immediate Send Checkbox */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    background-color: var(--bg-secondary);
    padding: 12px;
    border-radius: 12px;
}

.form-check-input {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.form-check-label {
    margin-bottom: 0;
    font-weight: 500;
    cursor: pointer;
}