﻿/* =========================================
   SPACE TYCOON - STABLE DARK UI
   ========================================= */

/* =========================================
   0. DEFINICE LOKÁLNÍCH FONTŮ
   ========================================= */

/* Normální verze (Regular - váha 400) */
@font-face {
    font-family: 'Roboto';
    src: url('../fonts/Roboto-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap; /* Rychlejší načtení */
}

/* Tučná verze (Bold - váha 700) */
@font-face {
    font-family: 'Roboto';
    src: url('../fonts/Roboto-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}




/* 1. GEOMETRIE (Aby layout nezmizel) */
html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #0b0c10;
    color: #c5c6c7;
    font-family: 'Roboto', Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

/* --- SCI-FI SCROLLBAR --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: #00bcd4; /* Svítí modře při chycení */
    }


/* 2. LAYOUT KONTEJNERY */
#main-menu {
    height: 40px;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;
    background: #1f2833;
    border-bottom: 2px solid #45a29e;
    display: flex;
    align-items: center;
    padding: 0 15px;
}

#layout-container {
    position: absolute;
    top: 40px;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: calc(100% - 40px);
    z-index: 1;
}

/* 3. PRVKY MENU */
.menu-brand {
    font-weight: bold;
    color: #66fcf1;
    letter-spacing: 2px;
    margin-right: 20px;
}

.menu-items button {
    background: transparent;
    border: none;
    color: #ccc;
    height: 40px;
    padding: 0 15px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

    .menu-items button:hover {
        background: #45a29e;
        color: #000;
    }

.menu-user {
    margin-left: auto;
    font-size: 0.8rem;
    color: #888;
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-logout {
    background: #d32f2f;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
}

/* 4. PLOVOUCÍ OKNA */
.floating-window {
    position: absolute;
    background: #1a1a1a;
    border: 1px solid #444;
    width: 500px;
    /* PŘIDÁNO: Maximální výška okna (např. 70 % výšky obrazovky) */
    max-height: 70vh;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    z-index: 9000; /* Bude vysoko */
    /* PŘIDÁNO: Plynulá animace při vyvolání existujícího okna */
    transition: transform 0.15s ease-out, border-color 0.15s ease-out;
}

.fw-header {
    background: #2a2a2a;
    padding: 0 12px 0 0;
    height: 36px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
    cursor: grab; /* Ukazuje, že to jde chytit */
    user-select: none;
}

    .fw-header:active {
        cursor: grabbing;
    }

/* Důležité: Flex pro zarovnání barevného čtverce v titulku */
.fw-title {
    display: flex;
    align-items: center;
    height: 100%;
    color: #fff;
    font-weight: bold;
    font-size: 1rem;
}

.fw-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
    padding-right: 10px;
}

    .fw-close:hover {
        color: #ff4444;
    }

.fw-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    /* PŘIDÁNO: Zapne rolování, pokud je obsah delší než okno */
    overflow-y: auto;
}

/* 5. SKLAD (DASHBOARD) - KARTIČKY */

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 5px; /* Malé mezery mezi kartičkami */
    padding: 10px;
}

.mat-item-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative; /* Důležité pro pozicování */
}


.mat-box {
    width: 100%;
    aspect-ratio: 1 / 1;
    position: relative;
    border-radius: 1px; /* Ostřejší hrany jako v PU */
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
    border: 1px solid transparent; /* Aby se při hoveru neměnila velikost */
    transition: border-color 0.1s; /* Jen barva rámečku, žádný pohyb */
}

.mat-item-wrapper:hover .mat-box {
    border-color: rgba(255,255,255,0.8);
    box-shadow: 0 0 8px rgba(255,255,255,0.2);
    z-index: 10;
}


.mat-ticker {
    font-family: 'Roboto',sans-serif;
    font-size: 1.1rem; /* Menší písmo */
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    user-select: none;
    text-transform: uppercase;
}

.mat-item-wrapper:hover .mat-ticker {
    color: rgba(255, 255, 255, 1);
}


/* Černé políčko pro množství v rohu */
.mat-amount {
    position: absolute;
    bottom: -1px;
    right: -1px;
    background-color: rgba(0, 0, 0, 0.9); /* Téměř černá */
    color: #e0e0e0; /* Světle šedá, ne zářivě bílá */
    font-size: 0.53rem;
    padding: 2px 4px;
    font-family: 'Roboto',sans-serif;
    font-variant-numeric: tabular-nums;
    font-weight: 400; /* V technickém fontu vypadá lépe tenčí */
    border-top-left-radius: 4px;
    line-height: 1;
}

    .mat-amount.zero {
        color: #555;
    }


.mat-full-name {
    font-family: 'Roboto', sans-serif;
    letter-spacing: 0.5px;
    margin-top: 2px;
    font-size: 0.65rem; /* Hodně malé, aby nerušilo */
    font-weight: 700;
    color: #888;
    text-align: left;
    overflow: hidden;
    /* white-space: nowrap;
        text-overflow: ellipsis;*/
    width: 100%;
    opacity: 0.7;
}

.mat-item-wrapper:hover .mat-full-name {
    color: #fff;
    opacity: 1;
}


/* =========================================
   8. DETAIL (PU STYLE REFACTOR)
   ========================================= */

/* Sekce (Production/Usage) */
.recipe-section {
    display: flex;
    border-bottom: 1px solid #333;
    background: #151515; /* Tmavé pozadí pod sekcí */
    min-height: 60px; /* Aby to nebylo spláclé */
}

/* Ten modrý svislý pruh vlevo */
.recipe-label {
    width: 28px;
    background: #2980b9; /* PU Modrá */
    color: #fff;
    writing-mode: vertical-lr;
    transform: rotate(180deg); /* Aby text šel zdola nahoru jako v PU */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 10px 0;
}

.recipe-list {
    flex-grow: 1;
    padding: 4px;
    background: #111; /* Ještě tmavší pro řádky */
}

/* Jeden řádek receptu */
.recipe-row {
    display: grid;
    /* Grid: Vstupy (flex) | Střed (pevný) | Výstupy (flex) */
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: center;
    background: #1a1a1d;
    margin-bottom: 4px;
    padding: 4px 8px;
    border: 1px solid #2a2a2a;
}

/* Skupina ikonek (vstupy/výstupy) */
.recipe-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

/* Středová sekce (@ [BUD] [ČAS] =>) */
.recipe-center {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
}

/* Modrý čtverec budovy */
.badge-building {
    width: 34px;
    height: 34px;
    background: #2980b9;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    border: 1px solid rgba(255,255,255,0.2);
    cursor: help;
}

/* Tmavý čtverec času */
.badge-time {
    background: #000;
    color: #ccc;
    height: 34px;
    min-width: 34px; /* Aby se vešel text */
    padding: 0 4px;
    display: flex;
    flex-direction: column; /* Čas pod sebou (1h 20m) */
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    line-height: 1.1;
    border: 1px solid #333;
    font-family: 'Roboto Condensed', sans-serif;
}

/* Info hlavička (Category vlevo, Váha vpravo) */
.detail-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: #0e0e0e;
    border-bottom: 1px solid #333;
    font-size: 0.75rem;
    color: #888;
}

/* Malé ikonky materiálů (v detailu receptu) */
.mini-mat-box {
    width: 34px;
    height: 34px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 400; /* Ticker zůstane tučný */
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    border: 1px solid transparent; /* Průhledný okraj defaultně */
    transition: border-color 0.1s; /* Jen barva, žádný pohyb */
}

.mini-amt {
    position: absolute;
    bottom: -1px;
    right: -1px;
    font-size: 0.6rem;
    color: #e0e0e0; /* Bílá/Světle šedá */
    font-weight: 400; /* Tenčí font pro čísla */
    background: #000; /* Čistě černá */
    padding: 1px 3px;
    line-height: 1;
    border-top-left-radius: 4px; /* Tím uděláme ten "ouškový" efekt */
    min-width: 12px;
    text-align: center;
}

/* Hover efekt - už se nezvětšuje, jen se rozsvítí rámeček */
.mini-mat-box:hover {
    border-color: rgba(255,255,255,0.8);
    z-index: 10;
}

/* Časová kartička (neproklikávací) */
.mini-time {
    width: 32px;
    height: 32px;
    background: #222;
    color: #888;
    font-size: 0.65rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px solid #444;
    line-height: 1.1;
    font-family: 'Roboto', sans-serif;
    user-select: none;
    margin-left: 4px;
}


/* 7. LOGIN */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box {
    width: 350px;
    padding: 40px;
    background: #1f2833;
    border: 1px solid #45a29e;
    text-align: center;
}

    .login-box input {
        width: 100%;
        margin-bottom: 20px;
        padding: 10px;
        background: #0b0c10;
        border: 1px solid #45a29e;
        color: #fff;
    }

    .login-box button {
        width: 100%;
        padding: 12px;
        background: #45a29e;
        border: none;
        font-weight: bold;
        cursor: pointer;
    }

/* =========================================
   6. VÝROBA (PRODUCTION LINES) - PU STYLE
   ========================================= */

#production-columns-wrapper {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    padding: 5px;
    height: 100%;
    align-items: flex-start; /* Sloupce začínají nahoře */
    /* DŮLEŽITÉ PRO SCROLLBARY: */
    flex-grow: 1; /* Roztáhni se do zbytku okna */
    overflow: auto; /* Zapni scrollbary (X i Y), když jsou potřeba */
    width: 100%; /* Aby fungoval horizontální scroll */
}

.prod-column {
    min-width: 220px;
    max-width: 220px;
    background: #0e0e0e;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    flex-shrink: 0; /* Aby se sloupce nemačkaly */
}

/* Hlavička sloupce (Název budovy) */
.prod-col-header {
    background: #1f2833;
    color: #66fcf1;
    padding: 6px 10px;
    font-weight: bold;
    font-size: 0.85rem;
    border-bottom: 1px solid #45a29e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ovládací tlačítka pod hlavičkou */
.prod-col-controls {
    display: flex;
    background: #111;
    border-bottom: 1px solid #333;
}

    .prod-col-controls button {
        flex-grow: 1;
        background: transparent;
        border: none;
        color: #eba900; /* Zlatá pro NEW ORDER */
        font-weight: bold;
        font-size: 0.7rem;
        padding: 6px 0;
        cursor: pointer;
        transition: 0.2s;
    }

        .prod-col-controls button:hover {
            background: #222;
        }

        .prod-col-controls button:first-child {
            border-right: 1px solid #333;
        }

/* Kontejner pro sloty */
.prod-active-slots {
    padding: 2px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* JEDEN SLOT (Řádek výroby) */
.prod-slot {
    height: 32px;
    border: 1px solid #222;
    display: flex;
    align-items: center;
    position: relative; /* Pro progress bar pozadí */
    overflow: hidden;
}

    .prod-slot.idle {
        background: #151515;
        color: #555;
    }

    .prod-slot.busy {
        /* Pozadí se řeší dynamicky v JS přes gradient */
        color: #fff;
        border-color: #555;
    }

/* Ikonka produktu vlevo ve slotu */
.slot-icon {
    width: 38px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    border-right: 1px solid rgba(0,0,0,0.5);
    background: #222;
    color: #888;
}

/* Texty ve slotu (vpravo) */
.slot-info {
    flex-grow: 1;
    padding: 0 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: 0.6rem;
    line-height: 1.1;
    z-index: 1; /* Aby text byl nad pozadím */
    text-shadow: 1px 1px 2px #000;
}

.slot-row {
    display: flex;
    justify-content: space-between;
}

/* Oddělovač Queue */
.prod-queue-separator {
    background: #080808;
    color: #444;
    font-size: 0.6rem;
    text-align: center;
    padding: 2px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
}

/* Fronta (čtverečky dole) */
.prod-queue-slots {
    padding: 2px;
    display: flex;
    flex-direction: column; /* Pod sebou jako v PU */
    gap: 2px;
    background: #0a0a0a;
    flex-grow: 1; /* Roztáhne se dolů */
}

.queue-box {
    height: 18px;
    border: 1px solid #222;
    background: #111;
}