/**
 * Infinigate LinkedIn Dashboard
 * Infinigate Brand: Coral (#ED5740), Dark Teal (#1A3A4A), White
 * Light Theme
 */

/* ============ CSS Variables ============ */
:root {
    /* Infinigate Brand Colors */
    --coral: #ED5740;
    --coral-light: #F47A68;
    --coral-dark: #D64530;
    --dark-teal: #1A3A4A;
    --dark-teal-light: #234D5F;
    
    /* Background colors - Light theme */
    --bg-primary: #F5F7FA;
    --bg-secondary: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F8FAFB;
    --bg-input: #F0F4F7;
    
    /* Sidebar - Keep dark for contrast */
    --sidebar-bg: #1A3A4A;
    --sidebar-text: #FFFFFF;
    --sidebar-text-muted: #8EAAB8;
    --sidebar-hover: #234D5F;
    --sidebar-active: #ED5740;
    
    /* Text colors */
    --text-primary: #1A3A4A;
    --text-secondary: #4A6572;
    --text-muted: #7A9AAD;
    
    /* Accent colors - Coral as primary */
    --accent-primary: #ED5740;
    --accent-secondary: #F47A68;
    --accent-gradient: linear-gradient(135deg, #ED5740 0%, #F47A68 100%);
    
    /* Status colors */
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    
    /* Border & misc */
    --border-color: #E2E8F0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    
    /* Shadows */
    --shadow: 0 1px 3px rgba(26, 58, 74, 0.08), 0 1px 2px rgba(26, 58, 74, 0.06);
    --shadow-lg: 0 4px 12px rgba(26, 58, 74, 0.1), 0 2px 4px rgba(26, 58, 74, 0.06);
    --shadow-glow: 0 0 20px rgba(237, 87, 64, 0.15);
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Plus Jakarta Sans', var(--font-sans);
    
    --transition: all 0.2s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-secondary);
}

/* ============ Typography ============ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

.text-gradient {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============ Login Page ============ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 3rem;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo img {
    height: 40px;
    margin-bottom: 1rem;
}

.login-logo h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

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

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.btn-block {
    width: 100%;
}

/* ============ Dashboard Layout ============ */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: none;
    padding: 1.5rem;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 2px 0 8px rgba(26, 58, 74, 0.1);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 1.5rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo img {
    height: 32px;
}

.sidebar-logo span {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--sidebar-text);
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.25rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text-muted);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

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

.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: white;
}

.sidebar-nav svg {
    width: 20px;
    height: 20px;
}

.sidebar-user {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: var(--sidebar-bg);
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    color: white;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--sidebar-text);
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--sidebar-text-muted);
}

/* ============ Main Content ============ */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.875rem;
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--text-secondary);
}

/* ============ Cards ============ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(237, 87, 64, 0.2);
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

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

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

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-gradient);
}

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

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-display);
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    margin-top: 0.5rem;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* ============ Tables ============ */
.table-container {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-secondary);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--bg-card-hover);
}

/* ============ Posts List ============ */
.post-item {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.post-item:hover {
    background: var(--bg-card-hover);
}

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

.post-item-large {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.post-item-large:hover {
    background: var(--bg-card-hover);
}

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

.post-image {
    flex-shrink: 0;
    width: 160px;
    height: 100px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-image img[src=""],
.post-image img:not([src]) {
    display: none;
}

.post-image:has(img[src=""]),
.post-image:has(img:not([src])),
.post-image:empty {
    display: none;
}

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

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

.post-header-small {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.post-company {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.post-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.post-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1rem;
}

.post-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.post-stats {
    display: flex;
    gap: 1rem;
}

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

.post-stat svg {
    width: 16px;
    height: 16px;
}

.post-stat.likes {
    color: var(--danger);
}

.post-stat.comments {
    color: var(--info);
}

@media (max-width: 992px) {
    .post-image {
        width: 140px;
        height: 90px;
    }
}

@media (max-width: 768px) {
    .post-item-large {
        flex-direction: column;
    }
    
    .post-image {
        width: 100%;
        height: 200px;
    }
    
    .post-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* ============ Alerts ============ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #dc2626;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #16a34a;
}

.alert-warning {
    background: rgba(237, 87, 64, 0.08);
    border: 1px solid rgba(237, 87, 64, 0.25);
    color: var(--text-primary);
}

.alert-warning .text-danger {
    color: var(--coral);
    font-weight: 700;
}

/* ============ Badge ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(237, 87, 64, 0.15);
    color: var(--coral);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

/* ============ Charts Container ============ */
.chart-container {
    position: relative;
    height: 300px;
}

/* ============ Grid Layouts ============ */
.grid {
    display: grid;
    gap: 1.5rem;
}

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

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

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

/* ============ Mobile Menu ============ */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 200;
    width: 48px;
    height: 48px;
    background: var(--sidebar-bg);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
    color: white;
}

.mobile-close-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--sidebar-text-muted);
}

.mobile-close-btn:hover {
    color: var(--sidebar-text);
}

.mobile-close-btn svg {
    width: 24px;
    height: 24px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 1.5rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

.sidebar-overlay.show {
    display: block;
}

@media (max-width: 768px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mobile-close-btn {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 150;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 5rem;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* ============ Empty State ============ */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ============ Loading ============ */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ============ Utilities ============ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

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

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

/* ============ Toggle Switch ============ */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.toggle-label input {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--border-color);
    border-radius: 13px;
    transition: var(--transition);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: var(--transition);
}

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

.toggle-label input:checked + .toggle-switch::after {
    left: 25px;
    background: white;
}

/* ============ Code Block ============ */
.code-block {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    overflow-x: auto;
}

.code-block code {
    color: var(--accent-primary);
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
}

/* ============ Form Help Text ============ */
.form-help {
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-top: 0.375rem;
}

/* ============ Alert Success ============ */
.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

/* ============ Padding Utilities ============ */
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

/* ============ Text Secondary ============ */
.text-secondary { color: var(--text-secondary); }

/* ============ Sidebar Logo Lowercase ============ */
.sidebar-logo span {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    text-transform: lowercase;
}

/* ============ Language Switcher ============ */
.lang-switcher {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    margin-top: 1rem;
}

.lang-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sidebar-text-muted);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    text-decoration: none;
}

.lang-btn:hover {
    color: var(--sidebar-text);
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.25);
}

.lang-btn.active {
    color: white;
    background: var(--coral);
    border-color: var(--coral);
}

/* Language switcher on login page */
.lang-switcher-login {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.lang-switcher-login .lang-btn {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    text-decoration: none;
}

.lang-switcher-login .lang-btn:hover {
    color: var(--text-primary);
    border-color: var(--coral);
}

.lang-switcher-login .lang-btn.active {
    color: white;
    background: var(--coral);
    border-color: var(--coral);
}
