/*
 * This file is part of the UX SDC Bundle
 *
 * (c) Jozef Môstka <https://github.com/tito10047/ux-sdc>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/* Styles for Dashboard component */
@layer components {
  .dashboard {
    display: flex;
    width: 1400px;
    max-width: 98vw;
    height: 70vh;
    max-height: 900px;
    margin: 2rem auto;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-m);
    overflow: hidden;
    color: var(--color-text-main);
    font-family: var(--font-sans);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);

    @media (max-width: 1440px) {
        width: 95vw;
        height: 95vh;
        margin: 1rem auto;
    }

    @media (max-width: 768px) {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        margin: 0;
        border-radius: 0;
    }

    & .dashboard__app-container {
        display: flex;
        width: 100%;
        height: 100%;
    }

    & .dashboard__main {
      flex: 1;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    & .dashboard__launcher {
        display: none;
        width: 100%;
        height: 100%;
        min-height: 400px;
        align-items: center;
        justify-content: center;
        background: radial-gradient(circle at center, rgba(255, 255, 255, 0.03) 0%, transparent 70%);
    }

    & .btn-simulation-start {
        background: var(--color-bg);
        border: 1px solid var(--color-border);
        color: var(--color-text-main);
        padding: 12px 24px;
        border-radius: var(--radius-m);
        font-family: var(--font-mono);
        font-size: var(--size-step--1);
        display: flex;
        align-items: center;
        gap: 12px;
        cursor: pointer;
        transition: var(--transition-fast);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);

        &:hover {
            border-color: var(--color-accent-blue);
            background: rgba(0, 112, 243, 0.05);
            box-shadow: 0 0 30px rgba(0, 112, 243, 0.1);
        }
    }

    & .btn-sim-icon {
        width: 18px;
        height: 18px;
        color: var(--color-accent-blue);
    }

    & .dashboard__content {
      flex: 1;
      overflow-y: auto;
      position: relative;
      background: #0D0D0D;
    }

    & .dashboard__placeholder {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 100%;
      gap: var(--space-s);
      animation: fade-in-dashboard 0.4s ease-out;
    }

    & .dashboard__placeholder-title {
        font-size: var(--size-step-2);
        color: var(--color-text-main);
        margin: 0;
    }

    & .dashboard__placeholder-text {
        color: var(--color-text-muted);
        margin: 0;
    }

    & .dashboard__placeholder-status {
        color: var(--color-accent-blue);
        font-family: var(--font-mono);
        font-size: var(--size-step--1);
        margin-top: var(--space-m);
    }

    & .dashboard__status-overlay {
        position: absolute;
        top: var(--space-m);
        right: var(--space-m);
        pointer-events: none;
        z-index: 100;
        font-family: var(--font-mono);
        font-size: var(--size-step--2);
        color: var(--color-accent-blue);
    }

    /* Popup Overlay */
    & .dashboard__popup-overlay {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.8);
        backdrop-filter: blur(4px);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 200;
        animation: fade-in 0.3s var(--ease-out);
    }

    & .dashboard__generating-popup {
        background: var(--color-bg);
        border: 1px solid var(--color-border);
        padding: var(--space-l);
        border-radius: var(--radius-m);
        width: 300px;
        text-align: center;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 112, 243, 0.1);
        position: relative;
        overflow: hidden;

        &::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 2px;
            background: var(--color-accent-blue);
            box-shadow: 0 0 10px var(--color-accent-blue);
            animation: progress-load 3s linear forwards;
        }
    }


    /* Animácia troch bodiek */
    & .generating-animation {
        display: flex;
        justify-content: center;
        gap: 12px;
        margin-bottom: var(--space-m);

        & .dot {
            display: block;
            width: 10px;
            height: 10px;
            background: var(--color-accent-blue);
            border-radius: 50%;
            filter: drop-shadow(0 0 10px var(--color-accent-blue));
            animation: dot-pulse-glow 1.2s infinite cubic-bezier(0.4, 0, 0.6, 1);
            will-change: transform, opacity;
            opacity: 1;

            &:nth-child(2) { animation-delay: 0.15s; }
            &:nth-child(3) { animation-delay: 0.3s; }
        }
    }


    & .generating-title {
        font-size: var(--size-step-1);
        margin-bottom: var(--space-s);
        color: var(--color-text-main);
    }

    & .generating-text {
        font-size: var(--size-step--1);
        color: var(--color-text-muted);
        margin-bottom: var(--space-l);
    }

    /* Štatistiky */
    & .dashboard__stats-view {
        padding: var(--space-l);
        animation: slide-up 0.4s var(--ease-out);

        & .stats-header {
            display: flex;
            align-items: center;
            gap: var(--space-m);
            margin-bottom: var(--space-xl);
        }

        & .btn-back {
            background: transparent;
            border: 1px solid var(--color-border);
            color: var(--color-text-muted);
            padding: 8px 16px;
            border-radius: var(--radius-s);
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 12px;
            transition: var(--transition-fast);

            &:hover {
                color: var(--color-text-main);
                border-color: var(--color-text-muted);
            }
        }

        & .stats-title {
            font-size: var(--size-step-2);
            font-weight: 700;
        }

        & .stats-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: var(--space-m);

            @media (max-width: 640px) {
                grid-template-columns: 1fr;
            }
        }

        & .stats-card {
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid var(--color-border);
            padding: var(--space-m);
            border-radius: var(--radius-m);
            display: flex;
            flex-direction: column;
            gap: 12px;

            &.is-wide {
                grid-column: span 2;
                @media (max-width: 640px) { grid-column: span 1; }
            }

            &__label {
                font-size: 10px;
                text-transform: uppercase;
                letter-spacing: 0.1em;
                color: var(--color-text-muted);
            }

            &__value {
                font-size: var(--size-step-3);
                font-weight: 700;
                font-family: var(--font-mono);
            }

            &__trend {
                font-size: 12px;
                padding: 2px 8px;
                border-radius: 4px;
                align-self: flex-start;

                &.is-up {
                    background: rgba(16, 185, 129, 0.1);
                    color: #10b981;
                }
            }
        }

        /* Mini Chart simulation */
        & .stats-card__chart-mini {
            display: flex;
            align-items: flex-end;
            gap: 4px;
            height: 40px;

            & .chart-bar {
                flex: 1;
                background: var(--color-accent-blue);
                opacity: 0.3;
                border-radius: 2px 2px 0 0;
                transition: height 0.3s ease;

                &:hover { opacity: 1; }
            }
        }

        & .stats-visual {
            display: flex;
            flex-direction: column;
            gap: 8px;

            & .visual-line {
                height: 4px;
                background: linear-gradient(to right, var(--color-accent-blue), transparent);
                border-radius: 2px;
                opacity: 0.5;
            }
        }
    }


    & .dashboard__mobile-search {
        display: none;
        padding: 12px 16px;
        background: #000000;
        border-bottom: 1px solid var(--color-border);
        align-items: center;
        gap: 12px;
    }

    & .mobile-search-icon {
        width: 16px;
        height: 16px;
        color: var(--color-text-muted);
    }

    & .mobile-search-input {
        background: transparent;
        border: none;
        color: var(--color-text-main);
        font-size: var(--size-step--1);
        outline: none;
        flex: 1;

        &::placeholder {
            color: var(--color-text-muted);
        }
    }

    & .dashboard__mobile-overlay {
        display: none;
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 90;
        cursor: pointer;
    }

    /* Responzívny dizajn */
    @media (max-width: 1024px) {
        min-height: 500px;

        & .dashboard__app-container {
            display: none;
        }

        & .dashboard__main {
            display: flex; /* Always display main inside app-container if container is shown */
        }

        & .dashboard__launcher {
            display: flex;
        }

        &.is-simulating {
            & .dashboard__app-container {
                display: flex;
                flex-direction: column;
            }
            & .dashboard__launcher {
                display: none;
            }
        }

        & .dashboard__mobile-search {
            display: flex;
        }

        &.sidebar-open .dashboard__mobile-overlay {
            display: block;
        }

        & .dashboard__sidebar-container {
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            z-index: 100;
            transform: translateX(-100%);
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            background: #0A0A0A;
            box-shadow: 20px 0 40px rgba(0, 0, 0, 0.5);

            &.is-open {
                transform: translateX(0);
            }
        }
    }
  }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-in-dashboard {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes dot-pulse-glow {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.3; filter: blur(2px); }
    50% { transform: translateY(-12px) scale(1.4); opacity: 1; filter: blur(0); }
}

@keyframes progress-load {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
