/* Dashboard Styles */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --background: #f8fafc;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    transition: opacity 0.2s;
}

.logo:hover {
    opacity: 0.8;
}

.logo i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
}

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

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-color);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--primary-color);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.nav-item .badge.warning {
    background: var(--warning-color);
}

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

.account-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.account-info:hover {
    background: var(--sidebar-hover);
}

.account-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.account-details {
    flex: 1;
}

.account-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
}

.account-plan {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    background: var(--card-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
}

.date-range-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--background);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.date-range-selector i {
    color: var(--text-secondary);
}

.date-range-selector select {
    border: none;
    background: none;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    outline: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

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

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger-color);
    border-radius: 50%;
    border: 2px solid white;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

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

/* Dashboard Container */
.dashboard-container {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

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

.metric-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.metric-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.metric-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.metric-icon.revenue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.metric-icon.profit {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.metric-icon.orders {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.metric-icon.acos {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.metric-info h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.metric-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.metric-change.positive {
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.metric-change.negative {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.metric-label {
    color: var(--text-secondary);
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.chart-card.large {
    grid-column: span 1;
}

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

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-chip {
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

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

/* PPC Metrics */
.ppc-metrics {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ppc-metric {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ppc-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.ppc-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ppc-bar {
    height: 8px;
    background: var(--background);
    border-radius: 4px;
    overflow: hidden;
}

.ppc-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.ppc-fill.success {
    background: var(--success-color);
}

/* Tables Section */
.tables-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.table-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table-card .card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.table-container {
    overflow-x: auto;
}

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

.data-table thead {
    background: var(--background);
}

.data-table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.data-table tr:hover {
    background: var(--background);
}

.sku-badge {
    background: var(--background);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-primary);
}

.profit-positive {
    color: var(--success-color);
    font-weight: 600;
}

.margin-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.75rem;
}

.margin-badge.high {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.margin-badge.medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.75rem;
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

/* Alerts Card */
.alerts-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.alerts-card .card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.alert-count {
    background: var(--danger-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.alerts-list {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid;
    background: var(--background);
}

.alert-item.critical {
    border-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.05);
}

.alert-item.warning {
    border-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.05);
}

.alert-item.info {
    border-color: var(--info-color);
    background: rgba(59, 130, 246, 0.05);
}

.alert-item.success {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.05);
}

.alert-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-item.critical .alert-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.alert-item.warning .alert-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.alert-item.info .alert-icon {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.alert-item.success .alert-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.alert-content {
    flex: 1;
}

.alert-content h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.alert-content p {
    font-size: 0.813rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.alert-actions {
    display: flex;
    gap: 1rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.813rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

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

.alert-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.action-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    text-align: center;
    transition: all 0.2s;
}

.action-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.action-card i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.action-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.action-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.btn-action {
    width: 100%;
    padding: 0.625rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover {
    background: var(--primary-dark);
}

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

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .topbar {
        padding: 1rem;
    }
    
    .dashboard-container {
        padding: 1rem;
    }
}

