:root {
    --bg-color: #0b0f19;
    --glass-bg: rgba(17, 24, 39, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Outfit', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font);
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(239, 68, 68, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.hidden { display: none !important; }
.mt-4 { margin-top: 1.5rem; }

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

/* Modal / Login */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(10px);
    z-index: 50;
}

.modal-content {
    padding: 3rem;
    border-radius: 1.5rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content h2 { font-size: 1.75rem; margin-bottom: 0.5rem; font-weight: 700; }
.modal-content p { color: var(--text-secondary); margin-bottom: 2rem; font-size: 0.95rem; }

.input-group { margin-bottom: 1rem; }

input, select.glass-select {
    width: 100%;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-family: var(--font);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus, select.glass-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    background: rgba(0, 0, 0, 0.4);
}

select.glass-select option {
    background: var(--bg-color);
    color: white;
}

button {
    font-family: var(--font);
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-primary {
    width: 100%;
    padding: 0.875rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 0.5rem;
}
.btn-icon:hover { background: rgba(255, 255, 255, 0.1); color: white; transform: rotate(15deg); }

.error-text { color: var(--danger); margin-top: 1rem; font-size: 0.875rem; }

/* Dashboard Layout (Sidebar + Content) */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    border-right: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    height: 100vh;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
    margin-bottom: 3rem;
}

.logo h1 { font-size: 1.5rem; font-weight: 700; color: white; letter-spacing: -0.5px; }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-btn, .nav-link {
    text-align: left;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.2s;
    display: block;
}

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

.nav-btn.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    font-weight: 600;
}

.logout-btn { margin-top: auto; width: 100%; }

.content {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
    max-width: 1200px;
}

.tab-content {
    animation: fadeIn 0.4s ease;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.tab-header h2 { font-size: 1.75rem; font-weight: 700; }

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

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

.stat-card {
    padding: 1.5rem;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value { font-size: 2.5rem; font-weight: 700; line-height: 1; font-family: var(--font-heading); }

/* Forms & Tables */
.actions-section { padding: 1.5rem; border-radius: 1rem; }
.actions-section h3 { margin-bottom: 1rem; font-size: 1.25rem; font-weight: 600; }

.action-form {
    display: flex;
    gap: 1rem;
}

.action-form input { flex: 1; }
.action-form .btn-primary { width: auto; padding: 0.75rem 2rem; }

.table-section { border-radius: 1rem; overflow: hidden; }
.table-container { overflow-x: auto; padding: 1rem; }

table { width: 100%; border-collapse: collapse; text-align: left; }
th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
}

tbody tr { transition: background-color 0.2s; }
tbody tr:hover { background-color: rgba(255, 255, 255, 0.05); }

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pending { background: rgba(245, 158, 11, 0.15); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.status-claimed { background: rgba(59, 130, 246, 0.15); color: var(--primary); border: 1px solid rgba(59, 130, 246, 0.3); }
.status-sent, .status-delivered { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.status-failed { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.status-no_webhook { background: rgba(148, 163, 184, 0.15); color: var(--text-secondary); border: 1px solid rgba(148, 163, 184, 0.3); }

.stat-sub { font-size: 0.78rem; color: var(--primary); min-height: 1rem; }
.action-grid { display: grid; grid-template-columns: 1.2fr 1.8fr 1fr auto; gap: 0.75rem; align-items: center; }
.action-grid .btn-primary { width: auto; padding: 0.875rem 1.5rem; white-space: nowrap; }
.actions-cell { display: flex; gap: 0.5rem; align-items: center; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; border-radius: 0.45rem; white-space: nowrap; }
.url-cell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85rem; }
.sub-error { font-size: 0.75rem; color: var(--danger); margin-top: 0.25rem; max-width: 220px; word-break: break-word; }
.secret-pill { display: inline-block; padding: 0.1rem 0.45rem; border-radius: 0.4rem; font-size: 0.7rem; background: rgba(59, 130, 246, 0.2); color: var(--primary); font-weight: 600; }
.modal-wide { max-width: 520px; }
.text-left { text-align: left; }
.input-label { display: block; font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 0.35rem; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-secondary); margin: 0.5rem 0 1.25rem; cursor: pointer; }
.checkbox-row input { width: auto; padding: 0; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1rem; }
.modal-actions .btn-primary { width: auto; padding: 0.75rem 1.5rem; }

/* Docs */
.docs-section { padding: 2rem; border-radius: 1rem; line-height: 1.6; }
.docs-section h3 { font-size: 1.25rem; color: var(--primary); margin-bottom: 0.5rem; }
.docs-section p { color: var(--text-secondary); margin-bottom: 1rem; }
.docs-section ul { padding-left: 1.5rem; color: var(--text-secondary); margin-bottom: 1rem; }
.docs-section ul li { margin-bottom: 0.5rem; }
.docs-section strong { color: white; }
.docs-section pre { background: rgba(0, 0, 0, 0.3); padding: 1rem; border-radius: 0.5rem; overflow-x: auto; color: var(--primary); border: 1px solid var(--glass-border); }
.docs-section code { font-family: monospace; }

@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 768px) {
    .dashboard { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--glass-border); padding: 1rem; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
    .logo { margin-bottom: 0; }
    .sidebar-nav { flex-direction: row; width: 100%; overflow-x: auto; margin-top: 1rem; }
    .nav-btn { white-space: nowrap; }
    .content { padding: 1rem; }
    .action-form { flex-direction: column; }
    .action-grid { grid-template-columns: 1fr; }
}
