/* =========================================================================
   Social Media Extractor — "Clean Slate" Light Theme
   ========================================================================= */

:root {
    /* Core Palette - Light & Vibrant */
    --bg-main: #f8fafc; /* Slate 50 */
    --bg-side: #0f172a; /* Slate 900 */
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9; /* Slate 100 */
    
    --primary: #2563eb; /* Royal Blue */
    --primary-hover: #1d4ed8;
    --primary-glow: rgba(37, 99, 235, 0.15);
    
    --accent: #0ea5e9; /* Sky Blue */
    
    --text-main: #334155; /* Slate 700 */
    --text-bright: #0f172a; /* Slate 900 */
    --text-muted: #64748b; /* Slate 500 */
    --text-on-dark: #f8fafc;
    
    --success: #10b981;
    --error: #ef4444;
    
    --border: #e2e8f0; /* Slate 200 */
    --border-hover: #cbd5e1; /* Slate 300 */
    
    /* Effects */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    
    --radius: 10px;
    --radius-lg: 16px;
    
    /* Transitions */
    --trans: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .stat-value {
    font-family: 'Outfit', sans-serif;
    color: var(--text-bright);
}

/* Global Icon Scaling Fix */
.icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Sidebar Navigation (Dark Contrast) */
.sidebar {
    width: 280px;
    background: var(--bg-side);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 2.5rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-header img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.sidebar-header h2 {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.2;
    color: white;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    padding: 0.75rem;
    flex: 1;
}

.nav-section {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #475569; /* Slate 600 */
    letter-spacing: 0.1em;
    margin: 1.5rem 0 0.5rem 1.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 1.25rem;
    color: #94a3b8; /* Slate 400 */
    text-decoration: none;
    font-weight: 600;
    border-radius: var(--radius);
    transition: var(--trans);
    margin-bottom: 2px;
}

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

.nav-link.active {
    color: white;
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.nav-link .icon {
    opacity: 0.7;
}

.nav-link.active .icon {
    opacity: 1;
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius);
    margin-top: 0.75rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Main Layout */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background-color: var(--bg-main);
}

.page-header {
    padding: 2.5rem 3rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.page-content {
    padding: 0 3rem 3rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
}

.card-body {
    padding: 2rem;
}

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

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

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

.stat-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    margin-top: 0.5rem;
    line-height: 1;
}

/* Table Styling (Fixing the Giant Icons) */
.table-wrapper {
    overflow-x: auto;
}

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

th {
    text-align: left;
    padding: 0.75rem 1.5rem;
    background: var(--bg-hover);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}

tr:hover td {
    background: #fdfdfd;
}

/* FIXED ICON SIZE IN TABLES */
.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-hover);
    color: var(--primary);
    transition: var(--trans);
    text-decoration: none;
}

.social-link:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.social-link .icon {
    width: 18px;
    height: 18px;
}

.social-empty {
    color: var(--border);
    font-weight: 700;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--trans);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: var(--trans);
}

.btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    box-shadow: var(--shadow-sm);
    color: var(--text-bright);
}

/* Badges */
.error-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--error);
    font-weight: 600;
    font-size: 0.85rem;
}

.error-badge .icon {
    width: 14px;
    height: 14px;
}

/* Tooltips & Redundant Text Fix */
.tooltip-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background: var(--bg-side);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    display: block; /* Ensure it stays block but hidden */
}

.tooltip-wrapper:hover .tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--bg-side);
}

/* Table Header Refinements */
.th-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: var(--trans);
    display: flex;
    align-items: center;
}

.btn-icon:hover {
    color: var(--primary);
    background: var(--bg-hover);
}

.btn-icon .icon {
    width: 16px;
    height: 16px;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { width: 80px; }
    .sidebar-header h2, .nav-link span, .nav-section, .user-name { display: none; }
    .sidebar-header { justify-content: center; }
    .nav-link { justify-content: center; }
}

@media (max-width: 768px) {
    body { flex-direction: column; overflow: auto; }
    .sidebar { width: 100%; height: auto; }
    .sidebar-header h2, .nav-link span, .user-name { display: block; }
    .nav-link { justify-content: flex-start; }
    .page-header { padding: 2rem 1.5rem 1rem; }
    .page-content { padding: 0 1.5rem 1.5rem; }
}

/* Toasts */
.toast-container { position: fixed; bottom: 2rem; right: 2rem; z-index: 10000; display: flex; flex-direction: column; gap: 0.75rem; }
.toast { background: white; border: 1px solid var(--border); padding: 1rem 1.25rem; border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 300px; display: flex; gap: 0.75rem; animation: slideInRight 0.3s ease; }

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

/* Global Confirm Modal */
.modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-content {
    background: white; border-radius: 16px; width: 100%; max-width: 400px;
    padding: 2rem; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
    animation: slideUpFade 0.3s ease;
}
.modal-title { font-size: 1.25rem; font-weight: 700; color: var(--text); margin-bottom: 0.75rem; }
.modal-message { font-size: 0.95rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 2rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 1rem; }
.modal-actions button { min-width: 100px; }

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