/* OLED Midnight Black Design Theme */
:root {
    --bg-oled: #000000;
    --bg-card: #09090b;
    --bg-card-hover: #121214;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.2);
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-orange: #f97316;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Fira Code', monospace;
    
    --transition-smooth: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body.oled-theme {
    background-color: var(--bg-oled);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

/* Auth Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-oled);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    transition: var(--transition-smooth);
}

.login-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 30px var(--accent-blue-glow);
}

.login-header {
    margin-bottom: 30px;
}

.logo-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background-color: var(--accent-blue-glow);
    color: var(--accent-blue);
    margin-bottom: 20px;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 8px;
}

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

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

.input-group input {
    width: 100%;
    background-color: var(--bg-oled);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 16px;
    transition: var(--transition-smooth);
}

.input-group input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px var(--accent-blue-glow);
}

.btn-primary {
    width: 100%;
    background-color: var(--text-primary);
    color: var(--bg-oled);
    border: none;
    border-radius: 8px;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-primary:hover {
    background-color: #ffffff;
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.error-msg {
    color: var(--accent-red);
    font-size: 14px;
    margin-bottom: 20px;
    text-align: left;
}

/* App Container */
.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pulse-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-green);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.brand h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.brand h1 span {
    color: var(--text-secondary);
    font-weight: 400;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-outline:hover {
    border-color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.05);
}

/* Bell Notifications */
.notifications-wrapper {
    position: relative;
}

.bell-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-smooth);
    position: relative;
}

.bell-button:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.bell-button .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: var(--accent-red);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 9999px;
    border: 2px solid var(--bg-oled);
}

.notifications-dropdown {
    position: absolute;
    top: 48px;
    right: 0;
    width: 360px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    z-index: 100;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-header h3 {
    font-size: 14px;
    font-weight: 600;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent-blue);
    font-size: 12px;
    cursor: pointer;
    font-weight: 500;
}

.btn-text:hover {
    text-decoration: underline;
}

.notifications-list {
    max-height: 320px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-smooth);
}

.notification-item:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.notification-item.unread {
    background-color: rgba(59, 130, 246, 0.03);
}

.notif-icon {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
}

.notif-icon.error { background-color: var(--accent-red); }
.notif-icon.warning { background-color: var(--accent-yellow); }
.notif-icon.info { background-color: var(--accent-blue); }

.notif-content {
    flex-grow: 1;
}

.notif-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.notif-msg {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.notif-time {
    font-size: 10px;
    color: var(--text-muted);
}

.empty-state {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Bento Grid */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.bento-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition-smooth);
}

.bento-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.card-gradient {
    position: relative;
    overflow: hidden;
}

.card-gradient::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 80%);
    pointer-events: none;
}

.card-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    flex-shrink: 0;
}

.card-icon.blue { background-color: rgba(59, 130, 246, 0.1); color: var(--accent-blue); }
.card-icon.green { background-color: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.card-icon.yellow { background-color: rgba(245, 158, 11, 0.1); color: var(--accent-yellow); }
.card-icon.purple { background-color: rgba(139, 92, 246, 0.1); color: var(--accent-purple); }

.card-info h3 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.card-value {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.card-trend {
    font-size: 11px;
    margin-top: 2px;
}

.text-green { color: var(--accent-green); }
.text-muted { color: var(--text-muted); }
.text-orange { color: var(--accent-orange); }
.text-purple { color: var(--accent-purple); }

/* Dashboard Layout Split */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
    flex-grow: 1;
}

/* Main Panel */
.main-panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

.panel-header {
    margin-bottom: 24px;
}

.panel-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.tabs-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tab-btn {
    background-color: var(--bg-oled);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-smooth);
}

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

.tab-btn.active {
    background-color: var(--text-primary);
    color: var(--bg-oled);
    border-color: var(--text-primary);
    font-weight: 600;
}

/* Posts List items */
.posts-list {
    min-height: 400px;
}

.post-item {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    transition: var(--transition-smooth);
}

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

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}

.post-author {
    color: var(--accent-blue);
    font-weight: 600;
    text-decoration: none;
}

.post-author:hover {
    text-decoration: underline;
}

.post-status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.post-status-badge.posted { background-color: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.post-status-badge.skipped { background-color: rgba(245, 158, 11, 0.1); color: var(--accent-yellow); }
.post-status-badge.error { background-color: rgba(239, 68, 68, 0.1); color: var(--accent-red); }

.post-content {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
    white-space: pre-wrap;
    background-color: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    padding: 12px;
    max-height: 120px;
    overflow-y: auto;
    margin-bottom: 8px;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
}

.post-link {
    color: var(--text-secondary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

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

.skip-reason-label {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 1px 6px;
    border-radius: 4px;
    color: var(--text-secondary);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.btn-nav {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-nav:hover:not(:disabled) {
    border-color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-nav:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

#page-indicator {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Sidebar Panel */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

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

.sidebar-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.chart-container {
    position: relative;
    width: 100%;
    height: 180px;
}

/* Funnel bars */
.ratio-bars {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ratio-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ratio-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.ratio-track {
    background-color: var(--bg-oled);
    height: 6px;
    border-radius: 3px;
    width: 100%;
    overflow: hidden;
}

.ratio-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease-out;
}

.bg-yellow { background-color: var(--accent-yellow); }
.bg-orange { background-color: var(--accent-orange); }
.bg-red { background-color: var(--accent-red); }

.loading {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Responsive constraints */
@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar-panel {
        order: -1; /* Place chart on top on mobile */
    }
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .nav-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .notifications-dropdown {
        right: auto;
        left: 0;
        width: calc(100vw - 48px);
    }
    
    .bento-grid {
        grid-template-columns: 1fr;
    }
    
    .tabs-container {
        max-width: 100%;
    }
}
