/* INDX Admin Styles */

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.5;
}

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    background: var(--gray-900);
    padding: 0 1.5rem;
    height: 56px;
}

.nav-brand a {
    color: white;
    font-weight: bold;
    font-size: 1.25rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-icon {
    flex-shrink: 0;
}

.nav-menu {
    display: flex;
    margin-left: 2rem;
    gap: 0.5rem;
}

.nav-item {
    color: var(--gray-300);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user {
    color: var(--gray-300);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: var(--gray-700);
}

.card-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.75rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.875rem;
    text-transform: uppercase;
}

.table tr:hover {
    background: var(--gray-100);
}

.table-sm th,
.table-sm td {
    padding: 0.5rem;
}

.actions {
    white-space: nowrap;
}

/* Sortable columns */
.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sortable:hover {
    color: var(--gray-900);
}

.sort-arrow {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.6rem;
    color: var(--gray-300);
    vertical-align: middle;
}

.sort-arrow.asc {
    color: var(--primary);
}

.sort-arrow.desc {
    color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    background: var(--gray-200);
    color: var(--gray-700);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.btn:hover {
    background: var(--gray-300);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}

.form-group small {
    color: var(--gray-500);
    font-size: 0.75rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-active, .status-completed {
    background: #dcfce7;
    color: #166534;
}

.status-pending, .status-paused {
    background: #fef3c7;
    color: #92400e;
}

.status-code_sent {
    background: #dbeafe;
    color: #1e40af;
}

.status-disabled, .status-left, .status-error {
    background: #fee2e2;
    color: #991b1b;
}

.status-flood_wait {
    background: #fae8ff;
    color: #86198f;
}

.status-banned {
    background: var(--gray-200);
    color: var(--gray-700);
}

.status-running {
    background: #dbeafe;
    color: #1e40af;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.status-inactive {
    background: var(--gray-200);
    color: var(--gray-500);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    background: var(--gray-200);
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    margin-left: 0.5rem;
}

.badge-danger, .badge-scam {
    background: #fee2e2;
    color: #991b1b;
}

.badge-fake {
    background: #fae8ff;
    color: #86198f;
}

.badge-verified {
    background: #dbeafe;
    color: #1e40af;
}

/* Health bar */
.health-bar {
    width: 60px;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    display: inline-block;
    vertical-align: middle;
}

.health-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
}

.health-value {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-left: 0.5rem;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--gray-900);
}

.stat-label {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.stat-card.positive .stat-value {
    color: var(--success);
}

.stat-card.negative .stat-value {
    color: var(--danger);
}

/* Stats periods */
.stats-periods {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
}

.stats-periods .btn.active {
    background: var(--primary);
    color: white;
}

/* Dashboard row */
.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .dashboard-row {
        grid-template-columns: 1fr;
    }
}

/* Settings grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
}

.filters select {
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
}

.filters label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Bulk action bar */
.bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
}

.bulk-bar-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    color: #1e40af;
}

.bulk-bar-actions {
    display: flex;
    gap: 0.5rem;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: 4px;
    cursor: pointer;
}

.pagination button:hover {
    background: var(--gray-100);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    min-width: 400px;
    max-width: 90%;
}

.modal-content h2 {
    margin-bottom: 1rem;
}

/* Switch toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gray-300);
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background: var(--success);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Reaction badges */
.reaction {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.reaction.positive {
    background: #dcfce7;
    color: #166534;
}

.reaction.negative {
    background: #fee2e2;
    color: #991b1b;
}

.reaction.neutral {
    background: var(--gray-200);
    color: var(--gray-700);
}

.reaction-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.reaction-badge.positive {
    background: #dcfce7;
    color: #166534;
}

.reaction-badge.negative {
    background: #fee2e2;
    color: #991b1b;
}

.reaction-badge.neutral {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* Post text */
.post-text {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Small 2-line date/time */
.text-small-2line {
    font-size: 0.75rem;
    line-height: 1.3;
    color: var(--gray-500);
    white-space: nowrap;
}

/* Subtitle under channel/post titles */
.text-sub {
    font-size: 0.7rem;
    color: var(--gray-500);
    white-space: nowrap;
}

tr.deleted {
    opacity: 0.5;
}

/* Emoji cell */
.emoji-cell {
    font-size: 1.5rem;
}

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-container h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.login-container .subtitle {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

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

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

/* State items */
.state-item {
    padding: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.state-item:last-child {
    border-bottom: none;
}

.state-item .error {
    color: var(--danger);
    font-size: 0.875rem;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 400px;
}

.toast-show {
    transform: translateX(0);
}

.toast-hide {
    transform: translateX(120%);
}

.toast-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.toast-success {
    background: #dcfce7;
    color: #166534;
    border-left: 4px solid #22c55e;
}

.toast-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.toast-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 0.5rem 1rem;
    }

    .nav-menu {
        order: 3;
        width: 100%;
        margin-left: 0;
        margin-top: 0.5rem;
        overflow-x: auto;
    }

    .container {
        padding: 1rem;
    }
}
