/* ============================================================
   RedditRadar — Complete Responsive Stylesheet
   Reddit-themed orange/dark palette, card-based dashboard
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --orange: #FF4500;
    --orange-dark: #CC3700;
    --orange-light: #FF8717;
    --orange-50: #FFF3ED;
    --dark: #1A1A1B;
    --dark-2: #272729;
    --dark-3: #343536;
    --dark-4: #3A3A3C;
    --gray: #818384;
    --gray-light: #D7DADC;
    --bg: #DAE0E6;
    --white: #FFFFFF;
    --green: #46D160;
    --red: #FF5252;
    --blue: #0079D3;
    --yellow: #FFB000;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    --transition: 0.2s ease;
    --max-width: 1200px;
    --sidebar-width: 240px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--dark);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* --- Utility --- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 16px; }
.text-center { text-align: center; }
.text-orange { color: var(--orange); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-gray { color: var(--gray); }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.w-full { width: 100%; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-primary {
    background: var(--orange);
    color: white;
}
.btn-primary:hover {
    background: var(--orange-dark);
    text-decoration: none;
}
.btn-secondary {
    background: var(--dark-3);
    color: white;
}
.btn-secondary:hover { background: var(--dark-4); }
.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-light);
    color: var(--dark);
}
.btn-outline:hover { border-color: var(--orange); color: var(--orange); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #d32f2f; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--dark-2);
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: white;
    transition: var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(255,69,0,0.1);
}
textarea.form-control { min-height: 80px; resize: vertical; }
select.form-control { cursor: pointer; }

/* --- Navbar --- */
.navbar {
    background: var(--dark);
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-weight: 700;
    font-size: 20px;
}
.navbar-brand:hover { text-decoration: none; }
.navbar-brand .logo-icon {
    width: 32px; height: 32px;
    background: var(--orange);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}
.navbar-links {
    display: flex;
    align-items: center;
    gap: 16px;
}
.navbar-links a {
    color: var(--gray-light);
    font-size: 14px;
    font-weight: 500;
}
.navbar-links a:hover { color: white; text-decoration: none; }
.navbar-user {
    color: var(--gray-light);
    font-size: 14px;
}

/* --- Sidebar (dashboard layout) --- */
.dashboard-layout {
    display: flex;
    min-height: calc(100vh - 56px);
}
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    padding: 16px 0;
    flex-shrink: 0;
}
.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--gray-light);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}
.sidebar a:hover {
    background: var(--dark-3);
    color: white;
    text-decoration: none;
}
.sidebar a.active {
    background: var(--dark-3);
    color: var(--orange);
    border-left: 3px solid var(--orange);
}
.sidebar .sidebar-icon { font-size: 18px; width: 24px; text-align: center; }

.main-content {
    flex: 1;
    padding: 24px;
    overflow-x: hidden;
}

/* --- Cards --- */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
}

/* --- Stat Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stat-card .stat-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 8px;
}
.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--dark);
}
.stat-card .stat-label {
    font-size: 13px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-icon.orange { background: var(--orange-50); color: var(--orange); }
.stat-icon.green { background: #E8F5E9; color: var(--green); }
.stat-icon.blue { background: #E3F2FD; color: var(--blue); }
.stat-icon.yellow { background: #FFF8E1; color: var(--yellow); }

/* --- Mention Cards --- */
.mention-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    margin-bottom: 12px;
    transition: var(--transition);
    border-left: 4px solid transparent;
}
.mention-card:hover { box-shadow: var(--shadow-lg); }
.mention-card.unread { border-left-color: var(--orange); }
.mention-card.sentiment-positive { border-left-color: var(--green); }
.mention-card.sentiment-negative { border-left-color: var(--red); }
.mention-card.sentiment-neutral { border-left-color: var(--gray); }

.mention-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.mention-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
}
.mention-title a { color: inherit; }
.mention-title a:hover { color: var(--orange); text-decoration: none; }
.mention-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.mention-meta .subreddit {
    background: var(--orange-50);
    color: var(--orange);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}
.mention-meta .score-badge {
    display: flex;
    align-items: center;
    gap: 2px;
}
.mention-body {
    font-size: 14px;
    color: var(--dark-3);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mention-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}
.mention-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* --- Sentiment Badge --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.badge-positive { background: #E8F5E9; color: #2E7D32; }
.badge-negative { background: #FFEBEE; color: #C62828; }
.badge-neutral { background: #F5F5F5; color: var(--gray); }
.badge-orange { background: var(--orange-50); color: var(--orange); }
.badge-blue { background: #E3F2FD; color: var(--blue); }

/* --- Lead Score Indicator --- */
.lead-score {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
}
.lead-score.high { color: var(--green); }
.lead-score.medium { color: var(--yellow); }
.lead-score.low { color: var(--gray); }
.lead-score-bar {
    width: 60px;
    height: 6px;
    background: var(--gray-light);
    border-radius: 3px;
    overflow: hidden;
}
.lead-score-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}
.lead-score-fill.high { background: var(--green); }
.lead-score-fill.medium { background: var(--yellow); }
.lead-score-fill.low { background: var(--gray); }

/* --- Kanban Board (Leads) --- */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.kanban-column {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    min-height: 200px;
}
.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 15px;
    color: var(--dark);
}
.kanban-column-count {
    background: var(--dark-3);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}
.kanban-card {
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 10px;
    cursor: grab;
    transition: var(--transition);
}
.kanban-card:hover { box-shadow: var(--shadow-lg); }
.kanban-card.dragging { opacity: 0.5; }
.kanban-card .kanban-card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}
.kanban-card .kanban-card-meta {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 8px;
}
.kanban-card .kanban-card-notes {
    font-size: 13px;
    color: var(--dark-3);
    margin-bottom: 8px;
}
.kanban-card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* --- Landing Page --- */
.hero {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-3) 100%);
    color: white;
    padding: 80px 0 100px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%; left: -10%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(255,69,0,0.15) 0%, transparent 70%);
    pointer-events: none;
}
.hero h1 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.2;
    position: relative;
}
.hero h1 .highlight { color: var(--orange); }
.hero p {
    font-size: 20px;
    color: var(--gray-light);
    max-width: 600px;
    margin: 0 auto 32px;
    position: relative;
}
.hero .hero-cta {
    display: flex;
    gap: 16px;
    justify-content: center;
    position: relative;
}

.section { padding: 64px 0; }
.section-title {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}
.section-subtitle {
    font-size: 18px;
    color: var(--gray);
    text-align: center;
    margin-bottom: 48px;
}

.how-it-works {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 32px;
}
.step-card {
    text-align: center;
    padding: 24px;
}
.step-card .step-number {
    width: 56px; height: 56px;
    background: var(--orange);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    margin: 0 auto 16px;
}
.step-card h3 { font-size: 20px; margin-bottom: 8px; }
.step-card p { color: var(--gray); font-size: 15px; }

/* --- Pricing --- */
.pricing-section { background: white; }
.pricing-card {
    max-width: 400px;
    margin: 0 auto;
    background: white;
    border: 2px solid var(--orange);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.pricing-card .plan-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--orange);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.pricing-card .plan-price {
    font-size: 56px;
    font-weight: 800;
    color: var(--dark);
    margin: 16px 0;
}
.pricing-card .plan-price .currency { font-size: 24px; vertical-align: top; }
.pricing-card .plan-price .period { font-size: 18px; color: var(--gray); font-weight: 400; }
.pricing-card ul {
    list-style: none;
    margin: 24px 0;
    text-align: left;
}
.pricing-card ul li {
    padding: 8px 0;
    font-size: 15px;
    color: var(--dark-3);
    display: flex;
    align-items: center;
    gap: 8px;
}
.pricing-card ul li::before {
    content: '✓';
    color: var(--green);
    font-weight: 700;
    font-size: 18px;
}

/* --- Social Proof --- */
.social-proof {
    background: var(--dark);
    color: white;
    padding: 48px 0;
}
.social-proof-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
    text-align: center;
}
.social-proof-stat .stat-number {
    font-size: 40px;
    font-weight: 800;
    color: var(--orange);
}
.social-proof-stat .stat-desc {
    font-size: 14px;
    color: var(--gray-light);
    margin-top: 4px;
}

/* --- Auth Pages --- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark);
    padding: 20px;
}
.auth-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    max-width: 420px;
    width: 100%;
}
.auth-card .auth-logo {
    text-align: center;
    margin-bottom: 24px;
}
.auth-card .auth-logo a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
}
.auth-card .auth-logo a:hover { text-decoration: none; }
.auth-card h2 {
    font-size: 24px;
    margin-bottom: 8px;
    text-align: center;
}
.auth-card .auth-subtitle {
    text-align: center;
    color: var(--gray);
    margin-bottom: 24px;
    font-size: 14px;
}
.auth-card .auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--gray);
}

/* --- Alerts / Messages --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}
.alert-success { background: #E8F5E9; color: #2E7D32; border: 1px solid #A5D6A7; }
.alert-error { background: #FFEBEE; color: #C62828; border: 1px solid #EF9A9A; }
.alert-info { background: #E3F2FD; color: #1565C0; border: 1px solid #90CAF9; }

/* --- Filters Bar --- */
.filters-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 20px;
    background: white;
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.filters-bar select,
.filters-bar input {
    padding: 8px 12px;
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
}
.filters-bar .filter-spacer { flex: 1; }

/* --- Toggle Switch --- */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--gray-light);
    border-radius: 24px;
    transition: var(--transition);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--orange); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--gray);
}
.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}
.empty-state h3 { font-size: 18px; color: var(--dark-3); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* --- Loading Spinner --- */
.spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 3px solid var(--gray-light);
    border-top-color: var(--orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
    text-align: center;
    padding: 40px;
}

/* --- Footer --- */
.footer {
    background: var(--dark);
    color: var(--gray);
    padding: 32px 0;
    text-align: center;
    font-size: 14px;
}
.footer a { color: var(--gray-light); }

/* --- Table --- */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
table th, table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-light);
}
table th {
    font-weight: 700;
    color: var(--dark-2);
    background: var(--bg);
}
table tr:hover { background: var(--orange-50); }

/* --- Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: white;
    border-radius: var(--radius);
    padding: 32px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}
.modal h3 { margin-bottom: 16px; }
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
}
.pagination button {
    padding: 8px 14px;
    border: 1px solid var(--gray-light);
    background: white;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
}
.pagination button:hover:not(:disabled) {
    border-color: var(--orange);
    color: var(--orange);
}
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination .page-info { font-size: 14px; color: var(--gray); padding: 0 8px; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { padding: 16px; }
    .hero h1 { font-size: 32px; }
    .hero p { font-size: 16px; }
    .hero .hero-cta { flex-direction: column; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .kanban-board { grid-template-columns: 1fr; }
    .navbar-links { gap: 8px; }
    .navbar-links a { font-size: 13px; }
    .pricing-card { padding: 24px; }
    .pricing-card .plan-price { font-size: 40px; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .filters-bar select, .filters-bar input { width: 100%; }
    .modal { padding: 20px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 24px; }
    .section { padding: 40px 0; }
    .section-title { font-size: 24px; }
}
