/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color System */
    --bg-main: #F8FAFC;
    --bg-surface: rgba(255, 255, 255, 0.85);
    --bg-card: rgba(255, 255, 255, 0.95);
    
    --primary: #4F46E5;       /* Indigo Accent */
    --primary-glow: rgba(79, 70, 229, 0.08);
    --secondary: #059669;     /* Emerald Success/Accent */
    --secondary-glow: rgba(5, 150, 105, 0.08);
    
    --accent-purple: #7C3AED;  /* Violet */
    --accent-orange: #EA580C;  /* Orange */
    
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #64748B;
    
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.14);
    
    --success: #059669;
    --warning: #D97706;
    --error: #DC2626;
    --info: #2563EB;
    
    /* Effects */
    --glass-blur: 16px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    position: relative;
}

/* Background Gradients/Glows */
body::before {
    content: '';
    position: fixed;
    top: -200px;
    left: 20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    bottom: -100px;
    right: 10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.06) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Layout container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

/* Glassmorphism panel */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

/* Auth Layout */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent-purple));
}

.logo-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-text {
    font-size: 28px;
    background: linear-gradient(135deg, #1E293B 0%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    font-weight: 800;
}

.logo-highlight {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-title {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
    width: 100%;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: #FFFFFF;
}

.form-input-checkbox {
    width: auto;
    margin-right: 8px;
    accent-color: var(--primary);
}

.checkbox-label {
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    cursor: pointer;
}

.form-error {
    color: var(--error);
    font-size: 13px;
    margin-top: 6px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-purple) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    filter: brightness(1.1);
}

.btn-secondary {
    background: #FFFFFF;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: var(--border-hover);
}

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

.btn-danger:hover {
    filter: brightness(1.1);
}

.btn-full {
    width: 100%;
}

/* Layout Dashboard */
.dashboard-wrapper {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(var(--glass-blur));
    border-right: 1px solid var(--border-color);
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-logo {
    margin-bottom: 40px;
    display: block;
    text-decoration: none;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
    gap: 12px;
}

.sidebar-link:hover, .sidebar-link.active {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.04);
}

.sidebar-link.active {
    background: var(--primary-glow);
    color: var(--primary);
    border-left: 3px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
}

.user-credits {
    font-size: 12px;
    color: var(--secondary);
    font-weight: 500;
}

/* Main Content */
.main-content {
    padding: 40px;
    overflow-y: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title {
    font-size: 28px;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Cards & Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    padding: 24px;
}

.stat-title {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-value-highlight {
    background: linear-gradient(135deg, var(--primary), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.feed-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    margin-top: 40px;
}

/* Table styling */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    background: rgba(0, 0, 0, 0.02);
    padding: 16px 24px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-primary);
}

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

.custom-table tr:hover td {
    background: rgba(0, 0, 0, 0.01);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-pending { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-parsing { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.badge-processing { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }
.badge-completed { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-error { background: rgba(239, 68, 68, 0.15); color: var(--error); }

/* Progress bar */
.progress-container {
    width: 100%;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 9999px;
    height: 8px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent-purple));
    border-radius: 9999px;
    transition: width 0.4s ease;
}

/* Utility alert boxes */
.alert-box {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    border-left: 4px solid transparent;
}

.alert-error {
    background: rgba(239, 68, 68, 0.08);
    border-color: var(--error);
    color: #991B1B;
}

.alert-success {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--success);
    color: #065F46;
}

.alert-info {
    background: rgba(59, 130, 246, 0.08);
    border-color: var(--info);
    color: #1E40AF;
}

/* Detail Split View (Product Compare) */
.compare-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.compare-card {
    padding: 24px;
}

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

.compare-title {
    font-size: 16px;
    color: var(--text-secondary);
}

.compare-content {
    font-size: 15px;
    line-height: 1.6;
}

.compare-original { background: rgba(0, 0, 0, 0.01); }
.compare-optimized { background: rgba(99, 102, 241, 0.03); border-color: rgba(99, 102, 241, 0.2); }

/* Pricing Plan Grid */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.pricing-card {
    padding: 32px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pricing-card.popular {
    border-color: var(--primary);
    position: relative;
}

.pricing-badge {
    position: absolute;
    top: -12px;
    right: 24px;
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.plan-name {
    font-size: 20px;
    margin-bottom: 8px;
}

.plan-price {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 24px;
}

.plan-price span {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

.plan-features {
    list-style: none;
    margin-bottom: 32px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.plan-features li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.plan-features li::before {
    content: "✓";
    color: var(--secondary);
    font-weight: 700;
}

/* Custom Pagination Styling */
.custom-pagination nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.custom-pagination nav svg {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
}

.custom-pagination nav > div:first-child {
    display: none;
}

@media (max-width: 640px) {
    .custom-pagination nav > div:first-child {
        display: flex;
        width: 100%;
        justify-content: space-between;
    }
    .custom-pagination nav > div:last-child {
        display: none;
    }
}

.custom-pagination nav > div:last-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
}

.custom-pagination nav p {
    font-size: 14px;
    color: var(--text-secondary);
}

.custom-pagination nav span.relative {
    display: inline-flex;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.custom-pagination nav a, 
.custom-pagination nav span[aria-current="page"] > span,
.custom-pagination nav span.disabled {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.custom-pagination nav a:last-child,
.custom-pagination nav span:last-child > span {
    border-right: none;
}

.custom-pagination nav a:hover {
    background: rgba(0, 0, 0, 0.04);
}

.custom-pagination nav span[aria-current="page"] > span {
    background: var(--primary);
    color: white;
    font-weight: 600;
    border-color: var(--primary);
}

.custom-pagination nav span.disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}
