/* ============================================
   RAKIP ANALIZI DASHBOARD - PREMIUM DARK THEME 
   ============================================ */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-tertiary: #1a1a24;
    --bg-card: linear-gradient(145deg, #151520 0%, #111118 100%);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --text-primary: #f0f0f5;
    --text-secondary: #9898a8;
    --text-muted: #5a5a6e;
    --accent-green: #10B981;
    --accent-blue: #3B82F6;
    --accent-red: #EF4444;
    --accent-yellow: #F59E0B;
    --accent-purple: #8B5CF6;
    --border-color: rgba(255, 255, 255, 0.07);
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-sm: 8px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-glow-green: 0 0 30px rgba(16, 185, 129, 0.12);
    --sidebar-width: 250px;
    --transition: 0.25s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    padding: 20px 14px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent-green), #059669);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow-green);
}

.logo-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #aaa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    font-size: 0.9rem;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-green);
    transform: scaleY(0);
    transition: transform var(--transition);
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.nav-item.active {
    color: var(--text-primary);
    background: rgba(16, 185, 129, 0.1);
}

.nav-item.active::before {
    transform: scaleY(1);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.company-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(16, 185, 129, 0.08);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(16, 185, 129, 0.15);
    font-size: 0.85rem;
}

.badge-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1)
    }

    50% {
        opacity: .5;
        transform: scale(1.2)
    }
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 28px;
    min-height: 100vh;
    position: relative;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.breadcrumb {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.breadcrumb span {
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-refresh {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.btn-refresh:hover {
    background: var(--accent-green);
    color: white;
    border-color: var(--accent-green);
    transform: rotate(180deg);
}

.btn-refresh svg {
    width: 18px;
    height: 18px;
}

/* TABS */
.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

/* SUMMARY CARDS */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
}

.update-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-color, var(--accent-green));
}

.summary-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--card-color, var(--accent-green));
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.card-badge {
    font-size: 0.65rem;
    padding: 3px 7px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border-radius: 4px;
    font-weight: 600;
}

.card-badge.competitor {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.card-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.card-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.card-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.stat-item {}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* CHARTS */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    transition: all var(--transition);
}

.chart-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.chart-card.full {
    grid-column: 1/-1;
}

.chart-header {
    margin-bottom: 16px;
}

.chart-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

/* TABLE */
.data-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    margin-bottom: 28px;
}

.data-table-wrapper h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.table-scroll {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    white-space: nowrap;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.price-up {
    color: #10B981;
}

.price-down {
    color: #EF4444;
}

.price-neutral {
    color: var(--text-muted);
}

.no-data {
    color: var(--text-muted);
    font-style: italic;
}

/* FILTER BAR */
.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
}

.filter-bar select:focus,
.filter-bar input:focus {
    border-color: var(--accent-green);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.btn-filter {
    background: var(--accent-green);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition);
}

.btn-filter:hover {
    background: #059669;
    transform: translateY(-1px);
}

/* PRICE STATS - CLICKABLE */
.price-stats {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.price-stat-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.price-stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stat-color, var(--text-muted));
    transform: scaleX(0);
    transition: transform var(--transition);
}

.price-stat-card:hover {
    border-color: var(--stat-color, var(--text-muted));
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.price-stat-card:hover::after,
.price-stat-card.active::after {
    transform: scaleX(1);
}

.price-stat-card.active {
    border-color: var(--stat-color, var(--accent-green));
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.08);
}

.price-stat-card .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.price-stat-card .value {
    font-size: 1.3rem;
    font-weight: 700;
}

.price-stat-card .sub-value {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ROW HIGHLIGHTING */
tr.row-advantage td {
    background: rgba(16, 185, 129, 0.06);
}

tr.row-disadvantage td {
    background: rgba(239, 68, 68, 0.06);
}

tr.row-same td {
    background: rgba(245, 158, 11, 0.06);
}

/* PRICE ACTION BAR */
.price-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
    flex-wrap: wrap;
}

.price-action-bar .active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--accent-green);
    font-weight: 500;
}

.price-action-bar .active-filter-tag .close-tag {
    cursor: pointer;
    font-size: 1.1em;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.price-action-bar .active-filter-tag .close-tag:hover {
    opacity: 1;
}

.btn-export {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 7px 14px;
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.btn-export:hover {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

/* LOADING */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 16px;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

.loading-overlay p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* RESPONSIVE */
@media (max-width:1400px) {
    .summary-cards {
        grid-template-columns: repeat(3, 1fr);
    }

    .price-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width:1100px) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .price-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width:768px) {
    .sidebar {
        width: 60px;
        padding: 14px 8px;
    }

    .logo-text,
    .nav-item span,
    .sidebar-footer span {
        display: none;
    }

    .main-content {
        margin-left: 60px;
        padding: 16px;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .price-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}