/* ==========================================================================
   YPSOTEC - LAYOUT (LAYOUT.CSS)
   Verze: 1.0
   Popis: Základní rozložení stránky, grid, flex, menu, hlavička, footer
   ========================================================================== */

/* ========================================
   1. ZÁKLADNÍ KONTEJNERY
   ======================================== */
.page-container {
    display: flex;
    min-height: 100vh;
    background-color: var(--light-bg-color);
}

.content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

main {
    padding: 1.5rem;
    flex-grow: 1;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    gap: 1.5rem;
}

/* ========================================
   2. HLAVIČKA
   ======================================== */
.app-header {
    /*background: linear-gradient(100deg, rgba(0, 0, 0, 1) 0%, var(--secondary-color) 100%);*/
    background: linear-gradient(
        105deg, 
        rgba(0, 0, 0, 1) 0%, 
        rgba(23, 162, 184, 0.8) 60%,
        rgba(108, 117, 125, 0.7) 100%
    );
    color: white;
    height: 100px;
    padding: 1.25rem 2rem;
    box-shadow: var(--shadow-card);
    /* OPRAVENO: Odstraněno position: sticky, aby hlavička nescrollovala */
    position: relative;
    z-index: 10;
    width: 100%;
}

/*.app-header h1 {
    color: white;
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.app-header {
    background: linear-gradient(
        135deg, 
        rgba(0, 90, 156, 0.9) 0%, 
        rgba(23, 162, 184, 0.8) 50%,
        rgba(108, 117, 125, 0.7) 100%
    );
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 8px 32px rgba(0, 90, 156, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 100;
}*/

.app-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
}

.app-header h1 {
    background: linear-gradient(135deg, #8b8b8b 0%, rgba(189, 162, 162, 0.8) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-controls {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group label {
    color: #A9D1F3;
    font-weight: 500;
    white-space: nowrap;
    min-width: 130px; /* Fixní šířka pro zarovnání */
    text-align: right;
}

.control-group select {
    min-width: 150px;
}

/* ========================================
   3. POSTRANNÍ MENU
   ======================================== */
.logo-icon {
    width: 4em;  /* nebo konkrétní velikost jako 24px */
    height: 4em;
    margin-right: 0.1rem;  /* mezera mezi obrázkem a textem */
}

.nav-panel {
    width: 260px;
    flex-shrink: 0;
    background-color: var(--dark-bg-color);
    color: var(--text-light-color);
    overflow-y: auto;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    /* OPRAVENO: Defaultně menu pokračuje dolů */
    min-height: 100vh;
    height: 100%;
}

/* NOVÉ: Specifická třída pro terminál - menu do nekonečna */
body.terminal-page .nav-panel {
    min-height: 100vh;
    height: 100%;
}

/* NOVÉ: Specifická třída pro měřidla - menu přesně podle obsahu */
body.meridla-page .nav-panel {
    min-height: 100vh;
    height: 100%;
}

/* Pokud má stránka třídu "short-menu", menu bude kratší */
body.short-menu .nav-panel {
    min-height: auto;
    height: auto;
}

.nav-header {
    padding: 20px 25px;
    /*border-bottom: 1px solid #495057;*/
    background-color: #000000;
    height: 100px;
}
.nav-header a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #ffffff;
    transition: opacity var(--transition-speed);
    
}

.nav-header a:hover {
    opacity: 0.8;
}

.nav-header i {
    font-size: 2.5rem;
    margin-right: 15px;
    color: var(--primary-color);
}

.nav-header span {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.main-nav ul {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.main-nav li a {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    text-decoration: none;
    color: var(--text-light-color);
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

.main-nav li a:hover {
    background-color: #495057;
    color: #ffffff;
}

.main-nav li a.active {
    background-color: var(--primary-color);
    color: #ffffff;
    border-left-color: var(--secondary-color);
}

.main-nav li a i {
    width: 30px;
    font-size: 1.3rem;
    margin-right: 15px;
    text-align: center;
}

/* ========================================
   4. STATUS BAR (FOOTER)
   ======================================== */
.status-bar {
    background-color: var(--dark-bg-color);
    color: var(--text-light-color);
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.1);
    flex-shrink: 0;
    font-size: 1.25rem;
    /* OPRAVENO: Footer je sticky, zůstává viditelný při scrollování */
    position: sticky;
    bottom: 0;
    z-index: 100;
    transition: background-color 0.3s ease;
    width: 100%;
}

.status-bar .status-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.status-bar .label {
    color: #adb5bd;
    font-weight: 400;
    font-size: 1rem;
}

.status-bar strong {
    font-weight: 700;
    color: #ffffff;
}

/* Stavové barvy pro footer */
.status-bar.status-vyroba {
    background: linear-gradient(135deg, #4caf50, #66bb6a);
}

.status-bar.status-serizeni {
    background: linear-gradient(135deg, #ff9800, #ffa726);
}

.status-bar.status-povoleni {
    background: linear-gradient(135deg, #2196f3, #42a5f5);
}

.status-bar.status-porucha {
    background: linear-gradient(135deg, #f44336, #e57373);
}

.status-bar.status-ukonceni {
    background: linear-gradient(135deg, #9e9e9e, #bdbdbd);
}

/* Barvy textu pro světlé pozadí */
.status-bar.status-serizeni,
.status-bar.status-serizeni strong,
.status-bar.status-serizeni .label,
.status-bar.status-povoleni,
.status-bar.status-povoleni strong,
.status-bar.status-povoleni .label {
    color: var(--dark-bg-color);
}

.status-bar.status-serizeni .label,
.status-bar.status-povoleni .label {
    color: rgba(0, 0, 0, 0.7);
}

/* ========================================
   5. GRID LAYOUTY
   ======================================== */

/* Layout pro terminál - kusy */
.kusy-layout {
    grid-template-areas: "info entry";
    grid-template-columns: 2fr 1fr;
}

/* Layout pro terminál - protokol */
.protokol-layout {
    grid-template-areas: 
        "info info"
        "history entry";
    grid-template-columns: 3fr 2fr;
}

.info-panel { 
    grid-area: info; 
}

.entry-panel,
.protocol-entry-panel { 
    grid-area: entry; 
}

.protocol-history-panel { 
    grid-area: history; 
}

/* Informační mřížka */
.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem 1.5rem;
    margin-bottom: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-item-wide {
    grid-column: span 2;
}

.info-item .label {
    color: var(--label-color);
    font-weight: 500;
    font-size: 0.9rem;
}

.info-item .value {
    font-weight: 600;
    color: var(--text-color);
    font-size: 1.05rem;
}

/* Dvousloupcový layout s těsným umístěním */
.info-grid-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.info-grid-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* ========================================
   6. SEZNAM AKCÍ A FILTRŮ
   ======================================== */
.main-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
}

.search-grid {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr auto;
    gap: 1rem;
    align-items: flex-end;
}

.search-buttons {
    display: flex;
    gap: 0.5rem;
}

.table-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    animation: fadeIn 0.5s ease-out;
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
}

.stats-bar strong {
    color: var(--primary-color);
    font-size: 1.2em;
    font-weight: 700;
}

/* ========================================
   7. SEKCE DETAILŮ
   ======================================== */
.details-section {
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
}

.details-section h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.75rem;
    font-weight: 600;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-item .label {
    color: var(--label-color);
    font-weight: 500;
    font-size: 0.8em;
}

.detail-item .value {
    font-weight: 500;
    color: var(--text-color);
}

.detail-item .value.main {
    font-weight: bold;
    font-size: 1.1em;
    color: var(--primary-color);
}

/* ========================================
   8. DASHBOARD
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    animation: fadeIn 0.6s ease-out;
}

.stat-card {
    background: white;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all var(--transition-speed);
    box-shadow: var(--shadow-card);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.stat-card i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    transition: all var(--transition-speed);
}

.stat-card:hover i {
    transform: scale(1.1);
}

.stat-card h3 {
    font-size: 2.5rem;
    margin: 0.5rem 0;
    color: var(--text-color);
    font-weight: 700;
}

.stat-card p {
    color: var(--label-color);
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.stat-card.success { 
    border-left-color: var(--success-color); 
}

.stat-card.success i { 
    color: var(--success-color); 
}

.stat-card.error { 
    border-left-color: var(--error-color); 
}

.stat-card.error i { 
    color: var(--error-color); 
}

.stat-card.info { 
    border-left-color: var(--info-color); 
}

.stat-card.info i { 
    color: var(--info-color); 
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    animation: slideUp 0.5s ease-out;
}

.dashboard-section {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-speed);
}

.dashboard-section:hover {
    box-shadow: var(--shadow-hover);
}

.dashboard-section h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.75rem;
    font-weight: 600;
}

/* ========================================
   9. RESPONZIVITA
   ======================================== */
@media (max-width: 1200px) {
    .kusy-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "info"
            "entry";
    }
    
    .protokol-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "info"
            "history"
            "entry";
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .info-grid-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .page-container {
        flex-direction: column;
    }
    
    .nav-panel {
        width: 100%;
        height: auto;
    }
    
    .app-header {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        width: 100%;
    }
    
    .control-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group select {
        width: 100%;
    }
    
    .search-grid {
        grid-template-columns: 1fr;
    }
    
    .status-bar {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.75rem;
        font-size: 1.1rem;
        padding: 0.6rem 1rem;
        flex-wrap: wrap;
    }
    
    .status-bar > div {
        flex: 0 0 48%;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .info-item-wide {
        grid-column: span 1;
    }
    
    .main-actions-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    main {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .app-header h1 {
        font-size: 1.2rem;
    }
    
    .status-bar > div {
        flex: 0 0 100%;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   10. TISK
   ======================================== */
@media print {
    body {
        background-color: #fff !important;
    }
    
    .app-header,
    .entry-panel,
    .protocol-entry-panel,
    .loader-container,
    .notification,
    .nav-panel,
    .unity-container,
    .status-bar,
    .main-actions-bar,
    .search-grid,
    .table-actions,
    .no-print {
        display: none !important;
    }
    
    main,
    .container,
    .card {
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none;
    }
    
    .page-container {
        display: block;
    }
}

/* Vlastní styl pro tlačítko Zprávy v menu */
/*.main-nav li a#nav-zpravy {*/
   /* background-color: #3d3d3d;  Oranžová barva jako příklad */
   /* color: white;  Barva textu, aby byl čitelný */


/* Styl pro najetí myší */
.main-nav li a#nav-zpravy:hover {
    background-color: #233585; /* Tmavší oranžová při najetí */
}

/* Styl pro aktivní odkaz (pokud jste na dané stránce) */
.main-nav li a#nav-zpravy.active {
    background-color: #0c569b; /* Ještě tmavší oranžová pro aktivní stav */
    border-left-color: var(--secondary-color); /* Zachování levého okraje */
}