/* CloakTrack - Dark Theme */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a2035;
    --bg-card-hover: #1e2640;
    --bg-input: #0f1629;
    --border-color: #1e2a3a;
    --border-light: #2a3548;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-green: #22c55e;
    --accent-orange: #f97316;
    --accent-purple: #a855f7;
    --accent-red: #ef4444;
    --accent-cyan: #06b6d4;
    --accent-yellow: #eab308;
    --sidebar-width: 200px;
    --sidebar-bg: #0d1321;
    --topbar-height: 0px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: var(--accent-blue-hover); }

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #0a0e1a 0%, #111827 50%, #0a0e1a 100%);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .logo-icon {
    width: 48px;
    height: 48px;
    border: 2px solid var(--accent-green);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    position: relative;
}

.auth-logo .logo-icon::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    position: absolute;
}

.auth-logo h1 {
    font-size: 24px;
    font-weight: 700;
}

.auth-logo h1 span:first-child { color: var(--text-primary); }
.auth-logo h1 span:last-child { color: var(--accent-blue); }

.auth-title {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--text-secondary);
    text-align: center;
    font-size: 14px;
    margin-bottom: 24px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.form-check label {
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    margin: 0;
}

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

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

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

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.remember-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.remember-check input { accent-color: var(--accent-blue); }

.forgot-link {
    font-size: 14px;
    color: var(--accent-blue);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-blue-hover); color: #fff; }

.btn-success {
    background: var(--accent-green);
    color: #fff;
}
.btn-success:hover { background: #16a34a; color: #fff; }

.btn-danger {
    background: var(--accent-red);
    color: #fff;
}
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: 6px; }

.btn-group { display: flex; gap: 8px; }

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo .logo-circle {
    width: 32px;
    height: 32px;
    border: 2px solid var(--accent-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.sidebar-logo .logo-circle::after {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent-green);
    border-radius: 50%;
}

.sidebar-logo h1 {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-logo h1 span:first-child { color: var(--text-primary); }
.sidebar-logo h1 span:last-child { color: var(--accent-blue); }

.sidebar-nav { flex: 1; padding: 8px 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.03);
}

.nav-item.active {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.1);
    border-left-color: var(--accent-blue);
}

.nav-item .nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.user-details { flex: 1; min-width: 0; }
.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-email {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.sidebar-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    transition: color 0.2s;
}
.sidebar-action-btn:hover { color: var(--text-primary); }

.sign-out-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-red);
    font-size: 13px;
    padding: 4px 0;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
}
.sign-out-link:hover { color: #f87171; }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    min-height: 100vh;
}

/* Feature Cards (top banner) */
.feature-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
}

.feature-card .feature-label {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
}

.feature-card:nth-child(1) .feature-label { color: var(--accent-green); }
.feature-card:nth-child(2) .feature-label { color: var(--accent-purple); }
.feature-card:nth-child(3) .feature-label { color: var(--accent-orange); }
.feature-card:nth-child(4) .feature-label { color: var(--accent-cyan); }

.feature-card .feature-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.feature-card .feature-desc {
    font-size: 12px;
}

.feature-card:nth-child(1) .feature-desc { color: var(--accent-green); }
.feature-card:nth-child(2) .feature-desc { color: var(--accent-purple); }
.feature-card:nth-child(3) .feature-desc { color: var(--accent-orange); }
.feature-card:nth-child(4) .feature-desc { color: var(--accent-cyan); }

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.toolbar-left { display: flex; align-items: center; gap: 12px; }
.toolbar-right { display: flex; align-items: center; gap: 12px; }

.search-box {
    position: relative;
}

.search-box input {
    padding-left: 36px;
    min-width: 220px;
}

.search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Data Table */
.data-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: rgba(0,0,0,0.2);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

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

.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.badge-paused {
    background: rgba(249, 115, 22, 0.15);
    color: var(--accent-orange);
}

.badge-draft {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}

.badge-pending {
    background: rgba(234, 179, 8, 0.15);
    color: var(--accent-yellow);
}

.badge-verified {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.badge-failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

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

.page-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Campaign Create Form */
.campaign-form {
    max-width: 900px;
}

.form-section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.section-number {
    width: 32px;
    height: 32px;
    background: var(--accent-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.section-title h3 {
    font-size: 16px;
    font-weight: 600;
}

.section-title p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Protection mode toggle */
.protection-modes {
    display: flex;
    gap: 0;
    background: var(--bg-input);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid var(--border-color);
    width: fit-content;
}

.protection-mode-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.protection-mode-btn.active {
    background: var(--accent-blue);
    color: #fff;
}

.protection-mode-btn:hover:not(.active) {
    color: var(--text-primary);
}

/* Filter sections */
.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.filter-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
}

.filter-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.filter-card-header .filter-icon {
    font-size: 18px;
}

.filter-card-header h4 {
    font-size: 14px;
    font-weight: 600;
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 14px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--accent-green);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.alert-warning {
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.3);
    color: var(--accent-orange);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--accent-blue);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 { font-size: 18px; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

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

.pagination a, .pagination span {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.pagination a:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.pagination .active {
    background: var(--accent-blue);
    color: #fff;
}

/* Config summary */
.config-summary {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 20px;
    margin-top: 16px;
}

.config-summary h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-summary ul {
    list-style: disc;
    padding-left: 24px;
}

.config-summary li {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-orange { color: var(--accent-orange); }
.text-blue { color: var(--accent-blue); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* Plan warning */
.plan-warning {
    color: var(--accent-red);
    font-size: 13px;
    text-align: right;
}

/* Action buttons in table */
.action-btns {
    display: flex;
    gap: 6px;
}

.action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.action-btn.danger {
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.action-btn.danger:hover {
    background: rgba(239,68,68,0.15);
    color: var(--accent-red);
    border-color: var(--accent-red);
}

/* Back link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}
.back-link:hover { color: var(--text-primary); }

/* Notification dot */
.notification-bell {
    position: relative;
    cursor: pointer;
}

.notification-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    position: absolute;
    top: -2px;
    right: -2px;
}

/* Form bottom actions */
.form-bottom {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    margin-top: 16px;
}

/* Responsive */
@media (max-width: 1024px) {
    .feature-cards { grid-template-columns: repeat(2, 1fr); }
    .filter-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .feature-cards { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .form-row { flex-direction: column; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Knowledge Base & Support pages */
.kb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.kb-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    transition: border-color 0.2s;
}

.kb-card:hover { border-color: var(--accent-blue); }

.kb-card .kb-icon {
    font-size: 24px;
    margin-bottom: 12px;
}

.kb-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.kb-card p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Whitelist/Blacklist inline note */
.inline-note {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 12px 0;
}

.inline-note a { color: var(--accent-blue); font-weight: 500; }

/* Campaign form: subsection cards */
.security-filters-card, .whitelist-card, .blacklist-card, .destination-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
}

/* Tabs for settings */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.tab {
    padding: 10px 20px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover { color: var(--text-primary); }

.tab.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}
