:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --light: #f8fafc;
    --dark: #1e293b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --radius: 6px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--dark);
    background: var(--light);
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 56px;
    background: var(--dark);
    color: white;
}

.navbar-brand a {
    color: white;
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
}

.navbar-menu {
    display: flex;
    gap: 16px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

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

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

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--secondary);
    font-size: 13px;
}

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

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
}

.page-actions {
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    background: var(--light);
    color: var(--dark);
    border: 1px solid var(--border);
}

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

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

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

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

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

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

.btn-sm {
    padding: 4px 10px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--dark);
}

.stat-label {
    font-size: 13px;
    color: var(--secondary);
    margin-top: 4px;
}

.stat-new .stat-value { color: var(--primary); }
.stat-read .stat-value { color: var(--info); }
.stat-processed .stat-value { color: var(--success); }
.stat-today .stat-value { color: var(--warning); }

/* Filters */
.filters-bar {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
}

.filters-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-weight: 500;
    color: var(--secondary);
}

.filter-group select,
.filter-group input[type="text"] {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    min-width: 150px;
}

.filter-search {
    margin-left: auto;
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.data-table {
    width: 100%;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--light);
    font-weight: 600;
    font-size: 13px;
    color: var(--secondary);
}

.data-table tbody tr:hover {
    background: var(--light);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.col-checkbox { width: 40px; }
.col-id { width: 60px; }
.col-site { width: 100px; }
.col-form { width: 100px; }
.col-status { width: 100px; }
.col-date { width: 150px; }
.col-actions { width: 150px; }

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-new { background: #dbeafe; color: #1d4ed8; }
.status-read { background: #e0f2fe; color: #0369a1; }
.status-processed { background: #dcfce7; color: #15803d; }
.status-spam { background: #fee2e2; color: #b91c1c; }

tr.status-new { background: #f0f7ff; }

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

.pagination-info {
    color: var(--secondary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--secondary);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.alert-success {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

.alert-error {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

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

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.login-box h1 {
    font-size: 28px;
    text-align: center;
    margin-bottom: 8px;
}

.login-subtitle {
    text-align: center;
    color: var(--secondary);
    margin-bottom: 32px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

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

/* Submission Detail */
.submission-detail {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.detail-section {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.detail-section h2 {
    font-size: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-item label {
    font-size: 13px;
    color: var(--secondary);
    font-weight: 500;
}

.detail-item-full {
    grid-column: 1 / -1;
}

.data-table-detail .field-name {
    width: 200px;
    font-weight: 500;
    background: var(--light);
}

.data-table-detail .field-value pre {
    background: var(--light);
    padding: 8px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 0;
}

.action-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.status-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.raw-json {
    background: var(--dark);
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 13px;
}

/* Settings */
.settings-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-section {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.settings-section h2 {
    font-size: 16px;
    margin-bottom: 16px;
}

.settings-section h3 {
    font-size: 14px;
    margin-top: 20px;
    margin-bottom: 12px;
}

.settings-note {
    color: var(--secondary);
}

.settings-note code {
    background: var(--light);
    padding: 2px 6px;
    border-radius: 4px;
}

.settings-status {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.status-indicator {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.status-enabled {
    background: #dcfce7;
    color: #15803d;
}

.status-disabled {
    background: #f1f5f9;
    color: var(--secondary);
}

.settings-details p {
    margin-bottom: 8px;
    color: var(--secondary);
}

.settings-details strong {
    color: var(--dark);
}

.sites-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.site-item {
    padding: 12px;
    background: var(--light);
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-features {
    display: flex;
    gap: 6px;
}

.badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.badge-telegram {
    background: #0088cc;
    color: white;
}

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

.api-info {
    background: var(--light);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.api-info p {
    margin-bottom: 8px;
}

.api-info code {
    background: var(--dark);
    color: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
}

.code-example {
    background: var(--dark);
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 13px;
    white-space: pre;
}

.test-success {
    color: var(--success);
    font-weight: 500;
}

.test-error {
    color: var(--danger);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        height: auto;
        padding: 12px;
        gap: 12px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .filters-form {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-search {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .status-actions {
        flex-wrap: wrap;
    }
}

/* Sites page */
.info-box {
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
    color: #0369a1;
}

.info-box code {
    background: rgba(255, 255, 255, 0.5);
    padding: 2px 6px;
    border-radius: 4px;
}

.help-section {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 24px;
}

.help-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
}

.help-section ol {
    margin-left: 20px;
    line-height: 1.8;
}

.text-muted {
    color: var(--secondary);
    font-size: 12px;
    display: block;
    margin-top: 4px;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn {
    margin-right: 4px;
}

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

.site-url {
    display: block;
    font-size: 12px;
    color: var(--secondary);
    text-decoration: none;
    margin-top: 4px;
}

.site-url:hover {
    color: var(--primary);
    text-decoration: underline;
}
