﻿/* --- 1. ZÁKLADNÍ NASTAVENÍ A LAYOUT --- */
html {
    font-size: 14px;
    height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    font-family: 'Montserrat', sans-serif;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    margin: 0;
    background-color: #fff;
}

header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-content {
    flex: 1 0 auto;
}

footer {
    flex-shrink: 0;
    padding: 20px 0;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

/* --- 2. PORTFOLIO LIST (STRUKTURA) --- */
.portfolio-list {
    display: flex;
    flex-direction: column;
}

.asset-row {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.asset-main {
    display: flex;
    align-items: center;
    padding: 12px 5px;
    gap: 12px;
    cursor: pointer;
}

    .asset-main:hover {
        background-color: #fafafa;
    }

/* --- 3. SLOUPCE V ŘÁDKU --- */
.asset-info {
    flex: 1; /* Název firmy zabere zbytek místa a odtlačí ceny doprava */
    min-width: 0;
}

.company-name {
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #222;
    display: block;
}

.ticker-sub {
    font-size: 0.85rem;
    color: #666;
    text-transform: uppercase;
}

.asset-prices {
    text-align: right;
    min-width: 90px;
}

.current-price {
    font-weight: 600;
    font-size: 0.95rem;
    display: block;
}

.avg-price {
    font-size: 0.8rem;
    color: #999;
}

.asset-stats {
    min-width: 80px;
    text-align: right;
}

.pl {
    font-weight: 600;
    font-size: 0.95rem;
}

.pos {
    color: #28a745;
}

.neg {
    color: #dc3545;
}

/* --- 4. TLAČÍTKO ŠIPKY (S RÁMEČKEM) --- */
.asset-expand {
    flex: 0 0 auto;
}

.expand-mobile {
    width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f8f9fa;
    color: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

/* Zabezpečíme, že se točí jen vnitřek, ne ten rámeček */
.toggle-icon {
    transition: transform 0.3s ease-in-out;
    display: inline-block; /* Důležité pro správnou rotaci */
}

/* Varianta A: Třídu 'expanded' dostane celý řádek (lepší pro JS) */
.asset-row.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* Varianta B: Třídu 'expanded' dostane přímo ikona (pro jistotu) */
.toggle-icon.expanded {
    transform: rotate(180deg);
}

/* --- 5. DETAIL A GRAF --- */
.asset-details {
    padding-bottom: 20px;
    background-color: #fff;
}

.chart-controls {
    display: flex;
    justify-content: flex-end;
    /* Změníme padding: na pravé straně dáme 5px, aby to lícovalo s .asset-main */
    padding: 10px 0 0 0;
    background-color: transparent; /* Nebo barva pozadí tvého řádku */
}

.timeframe-selector {
    display: flex;
    gap: 2px;
    background: #f0f0f0;
    padding: 3px;
    border-radius: 8px;
}

.tf-btn {
    border: none;
    background: transparent;
    padding: 5px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
}

.tf-btn.active {
    background: #fff;
    color: #000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Kontejner pro tlačítko v patičce */
#push-notification-area {
    padding: 25px 15px;
    text-align: center;
    background: #f8f9fa; /* Jemné odlišení od zbytku stránky */
    border-top: 1px solid #e9ecef;
}

#enable-notifications-btn {
    all: unset; /* Reset výchozích stylů */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    color: #ffffff !important;
}

    /* Stav: Aktivovat (Investiční modrá) */
    #enable-notifications-btn:not(.btn-danger) {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }

    /* Stav: Zrušit (Decentní červená) */
    #enable-notifications-btn.btn-danger {
        background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    }

    #enable-notifications-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        filter: brightness(1.1);
    }

    #enable-notifications-btn:active {
        transform: translateY(0);
    }

/* Kontejner pro notifikace */
#notification-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    pointer-events: none;
    width: 100%;
    max-width: 350px;
    padding: 0 20px;
}

.invest-notification {
    /* Poloprůhledné pozadí (poslední číslo 0.7 je průhlednost) */
    background: rgba(25, 30, 35, 0.75) !important;
    /* KLÍČOVÁ VLASTNOST: Rozmazání obsahu pod notifikací */
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    color: white;
    padding: 16px 20px;
    border-radius: 18px;
    margin-bottom: 12px;
    /* Jemný vnitřní lesk (bílá linka na hraně) */
    border: 1px solid rgba(255, 255, 255, 0.15);
    /* Hluboký, měkký stín pro pocit prostoru */
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    animation: invest-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Upravíme i ikonu, aby v tom skle vynikla */
.notification-icon {
    background: rgba(52, 152, 219, 0.2); /* Průhledné pozadí ikony */
    border: 1px solid rgba(52, 152, 219, 0.5);
    width: 38px;
    height: 38px;
    border-radius: 12px; /* Čtverec se zaoblenými rohy ladí k modernímu UI */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3498db;
    flex-shrink: 0;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.notification-title {
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #3498db;
}

.notification-body {
    font-size: 0.9rem;
    opacity: 0.95;
}

/* Ubývající proužek (vysperkování) */
.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #3498db;
    width: 100%;
    animation: invest-progress 4s linear forwards;
}

/* Animace */
@keyframes invest-pop {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.8);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes invest-progress {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

.invest-notification.fade-out {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
    transition: all 0.5s ease;
}

/* --- TLAČÍTKO V PATIČCE (VYČIŠTĚNÉ) --- */
#enable-notifications-btn {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

    #enable-notifications-btn:not(.btn-danger) {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }

    #enable-notifications-btn.btn-danger {
        background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    }

    #enable-notifications-btn:hover {
        transform: translateY(-2px);
        filter: brightness(1.1);
        box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    }

    #enable-notifications-btn:active {
        transform: translateY(0);
    }


.market-dot {
    width: 6px;
    height: 6px;
    background-color: #28a745;
    border-radius: 50%;
    flex-shrink: 0;
    /* Efekt záře bez animace pro čistší vzhled, nebo pulse pro dynamiku */
    box-shadow: 0 0 5px #28a745;
}

/* Pokud chceš, aby to jemně dýchalo */
.market-dot {
    animation: market-glow 2s infinite;
}

@keyframes market-glow {
    0% {
        opacity: 0.8;
        transform: scale(0.9);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }

    100% {
        opacity: 0.8;
        transform: scale(0.9);
    }
}

/* Styl pro loader (rotující spinner) */
.fa-spin {
    font-size: 16px;
}

#assetSearch:focus {
    box-shadow: none; /* Odstraní modrý glow od Bootstrapu, máme vlastní shadow na group */
}

#clearSearch:hover {
    color: #dc3545 !important; /* Zčervená při najetí */
}

.input-group:focus-within {
    ring: 2px solid #3498db; /* Volitelný highlight celé skupiny při psaní */
}

/* --- DETAIL ASSETU - MINIMALISTICKÝ --- */
.asset-details .bg-light {
    background-color: #fafafa !important; /* Velmi jemná šedá */
    border: none !important; /* Žádný rámeček */
}

.detail-group {
    flex-direction: column;
}

.detail-label {
    font-size: 0.85rem;

    letter-spacing: 0.8px;
    color: #666;
    margin-bottom: -1px;
}

.detail-value {
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Svislá čára mezi sloupci - zjemněná */
.border-end {
    border-right: 1px solid #e2e8f0 !important;
}

.detail-unit {
    font-size: 0.75rem;
    font-weight: 400;
    margin-left: 2px;
}

.text-decoration-none:hover .bg-white {
    background-color: #f8f9fa !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
}

/* Pokud je karta aktivní, ikona bude bílá */
.bg-primary i, .bg-success i {
    color: white !important;
}

.bg-white i {
    color: #6c757d;
}

.border-success {
    border-color: #28a745 !important;
}

.border-warning {
    border-color: #ffc107 !important;
}

.italic {
    font-style: italic;
}


/* --- 6. MOBILNÍ SPECIFIKA (POD 576px) --- */
@media (max-width: 576px) {
    /* Edge-to-edge list */
    .portfolio-list {
        margin-left: -15px;
        margin-right: -15px;
    }

    .asset-row {
        padding-left: 7px;
        padding-right: 7px;
    }

    .asset-main {
        padding: 12px 0px;
        flex-wrap: nowrap; /* Držíme vše v jedné lince */
    }

    /* Šipka na mobilu - zachování rámečku */
    .expand-mobile {
        background-color: #fff;
        border-color: #ccc;
    }
}

/* --- 7. NAVIGACE (OFFCANVAS) --- */
@media (max-width: 991px) {
    .offcanvas-body {
        padding: 0;
    }

    .navbar-nav .nav-link {
        padding: 15px 20px !important;
        border-bottom: 1px solid #eee;
        font-weight: 500;
    }
}
