:root {
    --bg-dark: #0f1016;
    --bg-darker: #050508;
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.5);
    --text-main: #ffffff;
    --text-muted: #9ca3af;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-hover: rgba(139, 92, 246, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

.background-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    background:
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 40%);
    opacity: 0.8;
}

/* Global Components */
h1 {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.1;
}

h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

p {
    color: var(--text-muted);
}

.glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.text-gradient {
    background: linear-gradient(90deg, #fff, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6d28d9);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Dashboard specific styles */

.gate-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(20px);
    background: rgba(15, 16, 22, 0.8);
}

.login-card {
    padding: 3.5rem 3rem;
    max-width: 450px;
    width: 90%;
    text-align: center;
    border-radius: 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 30px var(--primary-glow);
}

.lock-icon {
    width: 60px;
    height: 60px;
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    border: 1px solid var(--glass-border);
}

.login-footer {
    margin-top: 2.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    opacity: 0.8;
}

.login-footer a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.login-footer a:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
    opacity: 1;
}

.login-card h2 {
    margin-bottom: 1rem;
    font-size: 2.2rem;
    font-weight: 700;
}

.login-card p {
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#password-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 1rem 1.5rem;
    border-radius: 50px;
    color: white;
    font-size: 1rem;
    text-align: left;
    outline: none;
    transition: all 0.3s ease;
}

#password-input:focus {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 0 20px var(--primary-glow);
}

.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

.error-text {
    color: #ff4d4d;
    font-size: 0.9rem;
    margin-top: 1rem;
    font-weight: 500;
}

/* Dashboard Layout */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 0;
    padding-top: 2rem;
}

.header-main h1 {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.badge-weekly {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    background: rgba(139, 92, 246, 0.1);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 50px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-main p {
    margin-top: 0.5rem;
    margin-bottom: 2rem;
}

/* Period Filter */
.period-filter {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem;
    border-radius: 12px;
    width: fit-content;
    border: 1px solid var(--glass-border);
}

.filter-btn {
    padding: 0.4rem 1rem;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.last-update {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding-bottom: 0.5rem;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.kpi-card {
    padding: 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    text-align: center;
    transition: transform 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

/* Standardize KPI text to white */
.kpi-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
}

/* Trend Indicators */
.kpi-trend {
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.trend-up {
    color: #4ade80;
}

.trend-down {
    color: #f87171;
}

/* Tooltips */
[data-tooltip] {
    position: relative;
    cursor: help;
}

.tooltip {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(15, 16, 22, 0.95);
    border: 1px solid var(--primary);
    color: white;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    width: 220px;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px var(--primary-glow);
    text-align: left;
    line-height: 1.4;
}

[data-tooltip]:hover .tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--primary) transparent transparent transparent;
}

/* Dashboard Layout & Alignment */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    align-items: stretch;
    width: 100%;
}

.comparison-section,
.strategy-section {
    width: 100%;
}

.strategy-card {
    padding: 2rem;
    border-radius: 24px;
    width: 100%;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.section-icon {
    width: 44px;
    height: 44px;
    background: rgba(139, 92, 246, 0.1);
    color: #a78bfa;
    /* Vibrant Purple */
    border-radius: 50%;
    /* Circle like login lock */
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(139, 92, 246, 0.2);
    flex-shrink: 0;
}

.section-header h3 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    color: white;
}

/* AI Category Style */
.ai-category-title {
    color: #a78bfa !important;
    font-weight: 600;
    display: block;
    margin-bottom: 0.4rem;
}

/* Table Styling */
table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th,
td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
    font-size: 1rem;
}

td:first-child {
    font-weight: 700;
    color: var(--text-main);
    width: auto;
    min-width: 200px;
    background: rgba(255, 255, 255, 0.02);
}

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td:first-child {
    font-weight: 600;
    color: var(--text-main);
    width: 200px;
}

/* Sparklines */
.sparkline-container {
    width: 140px;
    height: 40px;
}

.sparkline-path {
    fill: none;
    stroke: var(--primary);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 4px var(--primary-glow));
}

.sparkline-planeo {
    stroke: #60a5fa;
    filter: drop-shadow(0 0 4px rgba(96, 165, 250, 0.4));
}

.sparkline-alza {
    stroke: #4ade80;
    filter: drop-shadow(0 0 4px rgba(74, 222, 128, 0.4));
}

.sparkline-datart {
    stroke: #facc15;
    filter: drop-shadow(0 0 4px rgba(250, 204, 21, 0.4));
}

/* Day Pulse Grid */
.day-pulse-grid {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

.day-dot-pair {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.day-label-sm {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.1;
    transition: all 0.3s ease;
}

.pulse-dot.active {
    background: #a78bfa;
    /* Fialová accent */
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.5);
    opacity: 1;
}

.highlight-planeo .pulse-dot.active {
    background: #60a5fa;
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.4);
}

.highlight-alza .pulse-dot.active {
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
}

.highlight-datart .pulse-dot.active {
    background: #facc15;
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.4);
}

/* Status Highlighting */
.status-warn {
    color: #ff4d4d !important;
    font-weight: 700;
}

.comp-value {
    animation: fadeIn 0.5s ease forwards;
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.strategy-section {
    width: 100%;
}

.ai-content {
    line-height: 1.7;
    color: var(--text-main);
    font-size: 0.95rem;
}

.ai-item {
    margin-bottom: 1.5rem;
}

.ai-item strong,
.ai-item h3 {
    display: block;
    color: var(--primary);
    margin-bottom: 0.4rem;
    font-size: 1rem;
}

.strategy-card {
    background: rgba(139, 92, 246, 0.03);
    border: 1px solid var(--glass-border);
}

/* Subtle Column Highlighting */
.highlight-planeo {
    color: #60a5fa;
}

/* Brighter Blue */
.highlight-alza {
    color: #4ade80;
}

/* Brighter Green */
.highlight-datart {
    color: #facc15;
}

/* Brighter Yellow */

/* Yellow for Datart */

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.05) 25%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 2s infinite;
    border-radius: 4px;
    display: inline-block;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1.2rem;
    margin-bottom: 0.5rem;
    width: 100%;
}

.skeleton-title {
    height: 2rem;
    margin-bottom: 1rem;
    width: 60%;
}

.skeleton-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

/* Smart Alerts */
.smart-alerts-container {
    margin: 2.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.smart-alert {
    padding: 1rem 1.5rem;
    border-radius: 16px;
    background: rgba(245, 158, 11, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.2);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fbbf24;
    animation: alert-slide-in 0.5s ease-out;
}

.alert-icon {
    flex-shrink: 0;
    color: #f59e0b;
}

.alert-content {
    font-size: 0.95rem;
    font-weight: 500;
}

@keyframes alert-slide-in {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Micro-interactions */
.gate-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease-out;
}

#dashboard-content.fade-in {
    animation: content-entrance 1.2s cubic-bezier(0.2, 1, 0.3, 1);
}

@keyframes content-entrance {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
        filter: blur(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@media (max-width: 1100px) {
    .dashboard-layout {
        display: flex;
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    main {
        padding: 1.25rem;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .header-main h1 {
        font-size: 2.2rem;
        flex-wrap: wrap;
    }

    .badge-weekly {
        font-size: 0.8rem;
    }

    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .strategy-card {
        padding: 1.5rem;
    }
}

@media (max-width: 600px) {
    main {
        padding: 1rem;
    }

    .login-card {
        padding: 2.5rem 1.5rem;
    }

    .header-main h1 {
        font-size: 1.8rem;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    /* Stacked Table Logic (No Scroll) */
    .table-container {
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    #pulse-table thead {
        display: none;
    }

    #pulse-table,
    #pulse-table tbody,
    #pulse-table tr {
        display: block;
        width: 100%;
    }

    #pulse-table tr {
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid var(--glass-border);
        border-radius: 20px;
        margin-bottom: 2rem;
        padding: 1.25rem;
    }

    #pulse-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.85rem 0;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        white-space: normal;
        text-align: right;
    }

    #pulse-table td:last-child {
        border-bottom: none;
    }

    /* Metric Name Header */
    #pulse-table td:first-child {
        display: block;
        width: 100%;
        background: none;
        padding: 0 0 1rem 0;
        margin-bottom: 0.5rem;
        font-size: 1.2rem;
        color: var(--primary);
        border-bottom: 2px solid var(--primary);
        text-align: left;
    }

    /* Competitor Label Injection with official colors */
    #pulse-table td:not(:first-child)::before {
        content: attr(data-comp);
        font-weight: 700;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        flex-shrink: 0;
        margin-right: 1.5rem;
        text-align: left;
    }

    /* Specific brand colors for labels to make them POP */
    #pulse-table td.highlight-planeo::before {
        color: #60a5fa;
        opacity: 1;
    }

    #pulse-table td.highlight-alza::before {
        color: #4ade80;
        opacity: 1;
    }

    #pulse-table td.highlight-datart::before {
        color: #facc15;
        opacity: 1;
    }

    #pulse-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 0;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        white-space: normal;
    }

    /* Adjust specific metrics for mobile stacking */
    .day-pulse-grid {
        justify-content: flex-end;
        gap: 4px;
    }

    .day-dot-pair {
        gap: 2px;
    }

    .day-label-sm {
        font-size: 0.55rem;
    }

    .pulse-dot {
        width: 8px;
        height: 8px;
    }

    .section-header h3 {
        font-size: 1.3rem;
    }

    .last-update {
        font-size: 0.8rem;
    }
}

/* Error overlay styling */
.error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 16, 22, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
}

.error-content {
    background: var(--bg-darker);
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 2.5rem;
    border-radius: 24px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(139, 92, 246, 0.1);
}

.error-icon {
    width: 64px;
    height: 64px;
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.error-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
}

.error-message {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Standard Footer */
.dashboard-footer {
    text-align: center;
    padding: 4rem 0 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 4rem;
}

.dashboard-footer:hover {
    opacity: 1;
}

.dashboard-footer a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
    margin-left: 0.2rem;
}

.dashboard-footer a:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}