/* Telo prístroja, Status Bar, Skrutky a Animácie */
@layer components {
    :root{
        --space-m:5px;
    }
    .search {
        --color-body: #4a5d4e; /* Špinavá vojenská zelená */
        --color-panel: #3a473d;
        --color-screen-bg: #050a05;
        --color-phosphor: #00ff41;
        --color-phosphor-glow: rgba(0, 255, 65, 0.4);
        --font-retro: 'Courier New', Courier, monospace;

        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        padding-block: 2rem; /* Margin z hora a dola stránky */
        padding-inline: var(--space-l);
        background: linear-gradient(to bottom, #2c1e16 0%, #1a120d 100%); /* Starý úradnícky stôl - Tmavý orech */
        font-family: var(--font-retro);
        text-transform: uppercase;
        padding: 0;

        & .search__body {
            position: relative;
            /*width: 100%;*/
            max-width: 900px;
            background:
                radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 80%),
                repeating-radial-gradient(#4a5d4e 0, #4a5d4e 1px, #445647 2px, #4a5d4e 3px);
            background-size: 100% 100%, 4px 4px;
            background-blend-mode: soft-light;
            border: 8px solid #2d382f;
            border-radius: 4px;
            /* Vylepšený Backlight a vonkajší tieň vrhnutý na stôl */
            box-shadow:
                inset 2px 2px 5px rgba(255, 255, 255, 0.1),
                inset -2px -2px 5px rgba(0, 0, 0, 0.4),
                0 20px 50px rgba(0, 0, 0, 0.9), /* Tieň na stôl */
                0 0 100px rgba(0, 0, 0, 0.8); /* Backlight efekt */
            /*padding: var(--space-m);*/
            display: flex;
            flex-direction: column;
            gap: var(--space-m);

            @media (max-width: 768px) {
                height: calc(100dvh - 9rem); /* Zvýšené na 4rem pre lepší odstup */
                max-width: 100%;
                border-width: 4px;
                margin: 0;
                overflow: hidden; /* Dôležité pre mobilné rozloženie */
            }
        }

        /* Status Bar */
        & .search__status-bar {
            display: flex;
            gap: var(--space-m);
            padding: 9px 0px 0 35px;
            border-radius: 2px;
            position: relative;
            flex-wrap: wrap;

            @media (max-width: 768px) {
                padding-left: 25px;
                gap: 10px;
                display: grid;
                grid-template-columns: 1fr 1fr;
                max-width: 50%;
            }

            & .search__led {
                display: flex;
                align-items: center;
                gap: 6px;
                font-size: 10px;
                font-weight: bold;
                color: rgba(255, 255, 255, 0.6);

                & .search__dymo-label {
                    background: #000;
                    color: #fff;
                    padding: 1px 6px;
                    border-radius: 2px;
                    font-size: 8px;
                    letter-spacing: 0.5px;
                    box-shadow: 1px 1px 2px rgba(0,0,0,0.5);
                    text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.2);
                    border: 1px solid rgba(255, 255, 255, 0.1);
                    display: inline-block;
                }

                &::before {
                    content: '';
                    width: 8px;
                    height: 8px;
                    border-radius: 50%;
                    background: #333;
                    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
                }

                &[data-state="ok"]::before {
                    background: #4caf50;
                    box-shadow: 0 0 10px #4caf50, 0 0 20px rgba(76, 175, 80, 0.4); /* Glow efekt */
                }

                &[data-state="active"]::before {
                    background: #ff9800;
                    box-shadow: 0 0 10px #ff9800, 0 0 20px rgba(255, 152, 0, 0.4); /* Glow efekt */
                    animation: blink 2s infinite;
                }

                &[data-state="warning"]::before {
                    background: #f44336;
                    box-shadow: 0 0 10px #f44336, 0 0 20px rgba(244, 67, 54, 0.4); /* Glow efekt */
                    animation: led-blink 0.5s infinite;
                }

                &[data-state="jam"] {
                    color: #f44336;
                    &::before {
                        background: #f44336;
                        box-shadow: 0 0 15px #f44336, 0 0 25px rgba(244, 67, 54, 0.6); /* Glow efekt */
                        animation: led-blink 0.2s infinite;
                    }
                }
            }
        }

        /* Skrutky */
        & .search__screw {
            position: absolute;
            width: 12px;
            height: 12px;
            background: #555;
            border-radius: 50%;
            box-shadow: inset 2px 2px 3px rgba(255, 255, 255, 0.2),
            2px 2px 5px rgba(0, 0, 0, 0.5);

            &::after {
                content: '';
                position: absolute;
                top: 50%;
                left: 10%;
                right: 10%;
                height: 2px;
                background: #333;
                transform: rotate(45deg);
            }

            &.search__screw--top-left { top: 5px; left: 8px; }
            &.search__screw--top-right { top: 5px; right: 12px; }
            &.search__screw--bottom-left { bottom: 5px; left: 5px; }
            &.search__screw--bottom-right { bottom: 5px; right: 5px; }
        }

        /* Výrobný štítok (Nameplate) - Mosadzný/Strieborný s nitmi */
        & .search__nameplate {
            position: absolute;
            bottom: 12px;
            right: 20px;
            background: linear-gradient(135deg, #a8a8a8 0%, #7d7d7d 100%); /* Strieborný kov */
            padding: 8px 25px;
            border-radius: 2px;
            box-shadow:
                1px 1px 3px rgba(0, 0, 0, 0.5),
                inset 1px 1px 1px rgba(255, 255, 255, 0.3);
            border: 1px solid rgba(0, 0, 0, 0.3);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10;

            @media (max-width: 768px) {
                bottom: 10px;
                right: 10px;
                padding: 4px 15px;
            }

            & .search__nameplate-text {
                font-size: 14px;
                font-weight: bold;
                color: #222;
                letter-spacing: 2px;
                /* Vyrazené písmo (Inner shadow) */
                text-shadow:
                    -0.5px -0.5px 0px rgba(0, 0, 0, 0.8),
                    0.5px 0.5px 0px rgba(255, 255, 255, 0.3);
                opacity: 0.8;

                @media (max-width: 768px) {
                    font-size: 10px;
                    letter-spacing: 1px;
                }
            }

            & .search__rivet {
                position: absolute;
                width: 4px;
                height: 4px;
                background: #444;
                border-radius: 50%;
                box-shadow:
                    inset 1px 1px 1px rgba(255, 255, 255, 0.2),
                    0.5px 0.5px 1px rgba(0, 0, 0, 0.5);

                &.search__rivet--top-left { top: 3px; left: 3px; }
                &.search__rivet--top-right { top: 3px; right: 3px; }
                &.search__rivet--bottom-left { bottom: 3px; left: 3px; }
                &.search__rivet--bottom-right { bottom: 3px; right: 3px; }
            }
        }

        /* Ervínov Sticky Note (Lepiaci papierik) */
        & .search__sticky-note {
            position: absolute;
            right: 61px;
            top: 15px;
            width: 120px;
            min-height: 90px;
            background: #ffff88; /* Post-it žltá */
            padding: 10px;
            transform: rotate(3deg);
            box-shadow:
                2px 2px 5px rgba(0, 0, 0, 0.3),
                inset 0 0 10px rgba(0, 0, 0, 0.1);
            z-index: 100;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            border-bottom-right-radius: 40px 5px; /* Mierne ohnutý roh */

            & p {
                font-family: 'Special Elite', cursive, sans-serif; /* Ručne písaný/písací stroj efekt */
                font-size: 11px;
                color: #222;
                line-height: 1.2;
                text-transform: none; /* Nechceme uppercase na papieriku */
                margin: 0;
            }

            /* Efekt lepiacej pásky alebo len tieň pre odlepenie */
            &::before {
                content: '';
                position: absolute;
                top: -5px;
                left: 20%;
                width: 60%;
                height: 15px;
                background: rgba(255, 255, 255, 0.3); /* Priesvitná páska */
                transform: rotate(-2deg);
            }
        }
    }

    @keyframes blink {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.3; }
    }

    @keyframes led-blink {
        0%, 100% { filter: brightness(1) drop-shadow(0 0 5px currentColor); }
        50% { filter: brightness(0.3) drop-shadow(0 0 2px currentColor); }
    }
}
