/* ============================================
   INSTASYSTEM DASHBOARD - DIGITAL PAISAGISMO
   Tema: Verde Natureza / Profissional
   ============================================ */

/* ============ FONTS ============ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ============ CSS VARIABLES ============ */
:root {
    /* Brand Colors - Digital Paisagismo */
    --primary: #16a34a;
    --primary-dark: #15803d;
    --primary-light: #22c55e;
    --primary-soft: rgba(22, 163, 74, 0.1);
    --primary-gradient: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
    
    /* Secondary - Earth tones */
    --secondary: #78716c;
    --secondary-dark: #57534e;
    --secondary-light: #a8a29e;
    
    /* Accent - Warm */
    --accent: #f59e0b;
    --accent-dark: #d97706;
    --accent-light: #fbbf24;
    
    /* Backgrounds */
    --bg: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #e2e8f0;
    --white: #ffffff;
    
    /* Text */
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-light: #cbd5e1;
    
    /* Status Colors */
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --purple: #8b5cf6;
    
    /* Borders & Shadows */
    --border: rgba(0, 0, 0, 0.06);
    --border-strong: rgba(0, 0, 0, 0.12);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
    
    /* Sizing */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --sidebar-width: 280px;
    --navbar-height: 64px;
    
    /* Transitions */
    --transition-fast: all 0.15s ease;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ DARK MODE ============ */
[data-theme="dark"] {
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --white: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-light: #475569;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ============ RESET & BASE ============ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: var(--transition);
}

/* ============ SIDEBAR ============ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.5rem;
    margin-bottom: 2rem;
    text-decoration: none;
}

.sidebar-brand .brand-logo {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.sidebar-brand .brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand .brand-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.sidebar-brand .brand-sub {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.sidebar-nav {
    flex: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: var(--transition);
    margin-bottom: 0.25rem;
    position: relative;
}

.sidebar-nav a:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.sidebar-nav a.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}

.sidebar-nav a i {
    width: 22px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.sidebar-account {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
}

.sidebar-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.sidebar-account-info {
    flex: 1;
    min-width: 0;
}

.sidebar-account-name {
    font-weight: 600;
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-account-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.sidebar-account-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    transition: var(--transition);
}

.sidebar-account-status.online .dot {
    background: var(--success);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

/* Mobile sidebar */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }
}

/* ============ NAVBAR - Mobile ============ */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: space-between;
    height: var(--navbar-height);
}

[data-theme="dark"] .navbar {
    background: rgba(15, 23, 42, 0.95);
}

@media (max-width: 991px) {
    .navbar {
        display: flex;
    }
}

.navbar-brand {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.navbar-brand i {
    font-size: 1.25rem;
    color: var(--primary);
}

.navbar-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.625rem;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}

.navbar-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem 2.5rem;
    min-height: 100vh;
    transition: var(--transition);
}

@media (max-width: 991px) {
    .main-content {
        margin-left: 0;
        padding: calc(var(--navbar-height) + 1.25rem) 1rem 6rem;
    }
}

/* ============ PAGE HEADER ============ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.page-subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ============ CONTROLS BAR ============ */
.controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.period-filter {
    display: flex;
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 4px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.period-filter button {
    padding: 0.5rem 1.125rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition);
}

.period-filter button:hover {
    color: var(--text);
    background: var(--bg-secondary);
}

.period-filter button.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}

.theme-toggle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    transform: rotate(15deg);
}

.export-btn {
    padding: 0.625rem 1.125rem;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.export-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
}

/* Last updated indicator */
.last-updated {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.last-updated i {
    font-size: 0.75rem;
}

/* ============ ALERT BANNER ============ */
.alert-banner {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    display: none;
    align-items: center;
    gap: 0.875rem;
    animation: slideDown 0.3s ease;
}

.alert-banner.show {
    display: flex;
}

.alert-banner.warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #fde68a;
}

.alert-banner.success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #bbf7d0;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fee2e2;
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-banner.warning .alert-icon {
    background: #fef3c7;
    color: var(--warning);
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #991b1b;
    margin-bottom: 0.125rem;
}

.alert-banner.warning .alert-title {
    color: #92400e;
}

.alert-message {
    font-size: 0.8125rem;
    color: #b91c1c;
}

.alert-banner.warning .alert-message {
    color: #b45309;
}

.alert-dismiss {
    background: none;
    border: none;
    color: #b91c1c;
    cursor: pointer;
    padding: 0.5rem;
    opacity: 0.6;
    transition: var(--transition);
}

.alert-dismiss:hover {
    opacity: 1;
}

/* ============ DAEMON STATUS CARD ============ */
.daemon-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.daemon-card:hover {
    box-shadow: var(--shadow);
}

.daemon-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.daemon-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--danger);
    position: relative;
}

.daemon-indicator::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--danger);
    opacity: 0.3;
    animation: pulse-ring 2s infinite;
}

.daemon-indicator.running {
    background: var(--success);
}

.daemon-indicator.running::after {
    background: var(--success);
}

@keyframes pulse-ring {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.3); opacity: 0; }
}

.daemon-text h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.daemon-text p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
}

.daemon-actions {
    display: flex;
    gap: 0.625rem;
}

.btn-daemon {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-daemon.start {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}

.btn-daemon.start:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.35);
}

.btn-daemon.stop {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-daemon.stop:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
}

.btn-daemon:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-daemon .spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============ STATS GRID ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.875rem;
    }
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-4px);
}

/* Gradient top border */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: var(--transition);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card.likes::before { background: linear-gradient(135deg, #ef4444, #f87171); }
.stat-card.follows::before { background: var(--primary-gradient); }
.stat-card.comments::before { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.stat-card.unfollows::before { background: linear-gradient(135deg, #f59e0b, #fbbf24); }

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.likes { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.stat-icon.follows { background: var(--primary-soft); color: var(--primary); }
.stat-icon.comments { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.stat-icon.unfollows { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

.stat-trend {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-trend.up {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.stat-trend.down {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 300;
    line-height: 1;
    letter-spacing: -0.03em;
    margin-bottom: 0.375rem;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.stat-progress {
    margin-top: 1rem;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.stat-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.stat-progress-bar.likes { background: linear-gradient(90deg, #ef4444, #f87171); }
.stat-progress-bar.follows { background: var(--primary-gradient); }
.stat-progress-bar.comments { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.stat-progress-bar.unfollows { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.stat-limit {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Skeleton loading */
.stat-card.loading .stat-value,
.stat-card.loading .stat-label {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    color: transparent;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============ CHARTS GRID ============ */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.chart-card:hover {
    box-shadow: var(--shadow);
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.chart-legend {
    display: flex;
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.chart-container {
    position: relative;
    height: 280px;
}

.chart-container.pie {
    height: 260px;
}

/* Charts row */
.charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 991px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
}

/* ============ SETTINGS PANEL ============ */
.settings-panel {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.settings-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.settings-title i {
    color: var(--primary);
}

.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

/* Slider Control */
.slider-control {
    margin-bottom: 1.25rem;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.slider-value {
    font-weight: 600;
    color: var(--primary);
}

.slider-input {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-secondary);
    border-radius: 3px;
    outline: none;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-gradient);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
    transition: var(--transition);
}

.slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: var(--primary-gradient);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
}

/* Toggle Control */
.toggle-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border);
}

.toggle-control:last-child {
    border-bottom: none;
}

.toggle-label {
    font-size: 0.9375rem;
}

.toggle-label small {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-tertiary);
    border-radius: 14px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary-gradient);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* Hashtag Input */
.hashtag-section {
    margin-top: 1rem;
}

.hashtag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    max-height: 120px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.hashtag-tag {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 500;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.hashtag-tag button {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 0;
    font-size: 0.75rem;
    opacity: 0.7;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.hashtag-tag button:hover {
    opacity: 1;
    background: rgba(22, 163, 74, 0.2);
}

.hashtag-add {
    display: flex;
    gap: 0.5rem;
}

.hashtag-add input {
    flex: 1;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--white);
    color: var(--text);
    transition: var(--transition);
}

.hashtag-add input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.hashtag-add button {
    width: 44px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hashtag-add button:hover {
    transform: scale(1.05);
}

/* ============ RECENT ACTIONS ============ */
.recent-section {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.recent-header {
    width: 100%;
    background: none;
    border: none;
    padding: 1.125rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.recent-header:hover {
    background: var(--bg-secondary);
}

.recent-header i:last-child {
    transition: transform 0.3s ease;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.recent-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.recent-body.open {
    max-height: 600px;
    overflow-y: auto;
}

@media (min-width: 992px) {
    .recent-body {
        max-height: none !important;
    }
    
    .recent-header i:last-child {
        display: none;
    }
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.recent-item:hover {
    background: var(--bg-secondary);
}

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

.recent-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.recent-icon.like { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.recent-icon.follow { background: var(--primary-soft); color: var(--primary); }
.recent-icon.comment { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.recent-icon.unfollow { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

.recent-info {
    flex: 1;
    min-width: 0;
}

.recent-user {
    display: block;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-user a {
    color: var(--primary);
    text-decoration: none;
}

.recent-user a:hover {
    text-decoration: underline;
}

.recent-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.625rem;
    margin-top: 0.125rem;
}

.recent-status {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.recent-status.success { background: rgba(34, 197, 94, 0.1); color: var(--success); }
.recent-status.fail { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.empty-recent {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-recent i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-recent p {
    font-size: 0.9375rem;
}

/* ============ ACTION BUTTONS ============ */
.action-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.875rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
    transition: var(--transition);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.35);
}

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

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
}

.action-btn.secondary {
    background: var(--white);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.action-btn.secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow);
}

.action-btn.danger {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.action-btn.danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
}

/* ============ HISTORY TABLE ============ */
.history-container {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

.history-filters {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.filter-select,
.filter-input {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.875rem;
    background: var(--white);
    color: var(--text);
    transition: var(--transition);
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-input {
    width: 180px;
}

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

.history-table th {
    background: var(--bg-secondary);
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.history-table th:hover {
    background: var(--bg-tertiary);
}

.history-table th i {
    margin-left: 0.375rem;
    font-size: 0.625rem;
    opacity: 0.5;
}

.history-table th.sorted i {
    opacity: 1;
    color: var(--primary);
}

.history-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.history-table tr:hover td {
    background: var(--bg-secondary);
}

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

.history-action-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    font-weight: 500;
}

.history-action-badge.like { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.history-action-badge.follow { background: var(--primary-soft); color: var(--primary); }
.history-action-badge.comment { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.history-action-badge.unfollow { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

.history-link {
    color: var(--primary);
    text-decoration: none;
}

.history-link:hover {
    text-decoration: underline;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pagination-buttons {
    display: flex;
    gap: 0.375rem;
}

.pagination-btn {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-secondary);
    border-radius: var(--radius-xs);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============ MODAL ============ */
.modal-backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
}

[data-theme="dark"] .modal-content {
    background: var(--white);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.modal-title i {
    color: var(--primary);
}

.modal-body {
    padding: 1.5rem;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.module-btn {
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 1.75rem 1rem;
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
}

.module-btn:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.module-btn i {
    font-size: 1.75rem;
    color: var(--primary);
    display: block;
    margin-bottom: 0.875rem;
}

.module-btn span {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
}

/* ============ CONFIG PAGE ============ */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1.5rem;
}

.config-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.config-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.config-header:hover {
    background: var(--bg-secondary);
}

.config-header i:first-child {
    color: var(--primary);
    margin-right: 0.625rem;
}

.config-header i:last-child {
    transition: transform 0.3s ease;
    color: var(--text-muted);
}

.config-body {
    padding: 1.5rem;
}

.config-body.collapsed {
    display: none;
}

.config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border);
}

.config-row:last-child {
    border-bottom: none;
}

.config-row label {
    font-size: 0.9375rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.config-row input[type="number"],
.config-row input[type="text"] {
    width: 100px;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--bg-secondary);
    color: var(--text);
    text-align: center;
    transition: var(--transition);
}

.config-row input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
}

.save-btn {
    width: 100%;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
    transition: var(--transition);
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.35);
}

.save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============ TOAST NOTIFICATIONS ============ */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (max-width: 576px) {
    .toast-container {
        left: 16px;
        right: 16px;
        top: calc(var(--navbar-height) + 16px);
    }
}

.toast {
    background: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    border-left: 4px solid var(--info);
}

.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast-header {
    background: none;
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 1rem;
    font-weight: 600;
}

.toast-body {
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
}

/* ============ MOBILE BOTTOM NAV ============ */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 0.5rem;
    z-index: 999;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

@media (max-width: 991px) {
    .bottom-nav {
        display: flex;
        justify-content: space-around;
    }
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.625rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.6875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.bottom-nav a i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.bottom-nav a.active {
    color: var(--primary);
}

.bottom-nav a:active {
    transform: scale(0.95);
}

/* ============ SIDEBAR OVERLAY ============ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
    display: block;
    opacity: 1;
}

/* ============ UTILITIES ============ */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }

.bg-success { background: var(--success) !important; }
.bg-danger { background: var(--danger) !important; }

.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-xs);
}

.d-none { display: none !important; }
.d-flex { display: flex !important; }
.gap-2 { gap: 0.5rem !important; }

@media (min-width: 576px) {
    .d-sm-inline { display: inline !important; }
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

@media (max-width: 991px) {
    ::-webkit-scrollbar {
        width: 4px;
    }
}

/* ============ LIVE FEED ============ */
.live-feed-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: var(--transition);
}

.live-feed-card:hover {
    box-shadow: var(--shadow);
}

.live-feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, rgba(239, 68, 68, 0.02) 100%);
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.live-dot {
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    animation: live-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
}

@keyframes live-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

.live-text {
    font-weight: 700;
    font-size: 1rem;
    color: #ef4444;
    letter-spacing: -0.01em;
}

.live-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.live-status i {
    font-size: 0.75rem;
}

.live-status.active {
    color: var(--success);
}

.live-status.active i {
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.live-feed-body {
    max-height: 280px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.live-empty {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

.live-empty i {
    font-size: 2.5rem;
    margin-bottom: 0.875rem;
    opacity: 0.4;
}

.live-empty p {
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.live-empty small {
    font-size: 0.8125rem;
    opacity: 0.7;
}

.live-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid var(--border);
    animation: slideInLive 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: background 0.2s ease;
}

.live-item:hover {
    background: var(--bg-secondary);
}

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

@keyframes slideInLive {
    0% {
        opacity: 0;
        transform: translateX(40px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.live-item.new {
    background: rgba(34, 197, 94, 0.08);
}

.live-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9375rem;
    flex-shrink: 0;
}

.live-icon.like {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.live-icon.comment {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}

.live-icon.follow {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}

.live-icon.unfollow {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.live-content {
    flex: 1;
    min-width: 0;
}

.live-action {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-action a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.live-action a:hover {
    text-decoration: underline;
}

.live-action .hashtag {
    color: var(--info);
    font-weight: 500;
}

.live-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.live-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Mobile adjustments */
@media (max-width: 576px) {
    .live-feed-body {
        max-height: 220px;
    }
    
    .live-item {
        padding: 0.75rem 1rem;
        gap: 0.625rem;
    }
    
    .live-icon {
        width: 32px;
        height: 32px;
        font-size: 0.8125rem;
    }
    
    .live-action {
        font-size: 0.8125rem;
    }
}

/* ============ PRINT ============ */
@media print {
    .sidebar,
    .navbar,
    .bottom-nav,
    .toast-container {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
}
