/* ============================================================
   CZLAN Event Manager — Aplikační styly
   ============================================================ */

/* -------------------------------------------------------
   Proměnné (světlý motiv)
   ------------------------------------------------------- */
:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1a1d23;
    --sidebar-text: rgba(255,255,255,.75);
    --sidebar-hover: rgba(255,255,255,.08);
    --sidebar-active-bg: rgba(13,110,253,.25);
    --sidebar-active-text: #fff;
    --top-bar-height: 56px;
    --top-bar-bg: #fff;
    --top-bar-border: #e9ecef;
    --page-bg: #f8f9fa;
    --card-radius: .75rem;

    /* Barvy stavů */
    --status-planned: #0dcaf0;
    --status-to-realize: #0d6efd;
    --status-realized: #198754;
    --status-paid: #6f42c1;
    --status-cancelled: #dc3545;
    --status-archived: #6c757d;
    --status-pending: #ffc107;
}

/* Tmavý motiv */
[data-bs-theme="dark"] {
    --sidebar-bg: #0f1117;
    --sidebar-text: rgba(255,255,255,.7);
    --top-bar-bg: #1a1d23;
    --top-bar-border: #2d3139;
    --page-bg: #12151c;
}

/* -------------------------------------------------------
   Globální
   ------------------------------------------------------- */
body {
    background: var(--page-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* -------------------------------------------------------
   Layout: Sidebar + Content
   ------------------------------------------------------- */
#app-wrapper {
    min-height: 100vh;
}

/* Sidebar */
#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width .25s ease, min-width .25s ease;
    z-index: 100;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}

.sidebar-brand {
    color: #fff !important;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 1.1rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    white-space: nowrap;
}

.sidebar-brand i {
    font-size: 1.3rem;
    color: #0d6efd;
}

.sidebar-brand .sidebar-logo {
    flex-shrink: 0;
    object-fit: contain;
}

/* Navigační položky */
#sidebar .nav-link {
    color: var(--sidebar-text);
    border-radius: .5rem;
    padding: .5rem .85rem;
    margin-bottom: .1rem;
    font-size: .875rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

#sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

#sidebar .nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

#sidebar .nav-link i {
    font-size: 1rem;
    width: 1.2rem;
    flex-shrink: 0;
}

.nav-section-label {
    list-style: none;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.35);
    padding: .8rem .85rem .2rem;
    font-weight: 600;
}

/* Avatar v sidebaru */
.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #0d6efd;
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Top bar */
.top-bar {
    height: var(--top-bar-height);
    background: var(--top-bar-bg);
    border-bottom: 1px solid var(--top-bar-border);
    position: sticky;
    top: 0;
    z-index: 99;
}

.page-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

#page-content {
    background: var(--page-bg);
    overflow-x: hidden;
}

/* Nastavení — vertikální navigace */
.settings-nav .nav-link.active {
    font-weight: 600;
}

/* -------------------------------------------------------
   Auth stránky
   ------------------------------------------------------- */
.auth-page {
    background: linear-gradient(135deg, #0d1117 0%, #1a2332 100%);
}

.auth-wrapper {
    padding: 1rem;
}

.auth-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.auth-card-wide {
    max-width: 640px;
}

[data-bs-theme="dark"] .auth-card {
    background: #1a1d23;
}

/* -------------------------------------------------------
   Karty
   ------------------------------------------------------- */
.card {
    border-radius: var(--card-radius) !important;
}

/* -------------------------------------------------------
   Stavové badge
   ------------------------------------------------------- */
.badge.status-planned     { background: var(--status-planned);    color: #000; }
.badge.status-to-realize  { background: var(--status-to-realize); color: #fff; }
.badge.status-realized    { background: var(--status-realized);   color: #fff; }
.badge.status-paid        { background: var(--status-paid);       color: #fff; }
.badge.status-cancelled   { background: var(--status-cancelled);  color: #fff; }
.badge.status-archived    { background: var(--status-archived);   color: #fff; }
.badge.status-pending     { background: var(--status-pending);    color: #000; }

/* Řádky tabulky s barvou dle stavu */
tr.row-planned     { border-left: 3px solid var(--status-planned); }
tr.row-to-realize  { border-left: 3px solid var(--status-to-realize); }
tr.row-realized    { border-left: 3px solid var(--status-realized); }
tr.row-paid        { border-left: 3px solid var(--status-paid); }
tr.row-cancelled   { border-left: 3px solid var(--status-cancelled); opacity: .7; }
tr.row-archived    { border-left: 3px solid var(--status-archived); opacity: .5; }

/* -------------------------------------------------------
   Dashboard statistické karty
   ------------------------------------------------------- */
.stat-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* -------------------------------------------------------
   Chat
   ------------------------------------------------------- */
.chat-messages {
    max-height: 360px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .5rem 0;
}

.chat-message {
    max-width: 75%;
    align-self: flex-start;
}

.chat-message.own {
    align-self: flex-end;
}

.chat-meta {
    font-size: .7rem;
    color: var(--bs-secondary-color);
    margin-bottom: .15rem;
    display: flex;
    gap: .5rem;
}

.chat-message.own .chat-meta {
    flex-direction: row-reverse;
}

.chat-bubble {
    background: var(--bs-tertiary-bg);
    border-radius: .75rem;
    padding: .5rem .8rem;
    font-size: .875rem;
    line-height: 1.4;
    word-break: break-word;
}

.chat-message.own .chat-bubble {
    background: #0d6efd;
    color: #fff;
}

/* -------------------------------------------------------
   Silná stránkování + filtry
   ------------------------------------------------------- */
.filter-bar {
    background: var(--top-bar-bg);
    border: 1px solid var(--top-bar-border);
    border-radius: var(--card-radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

/* -------------------------------------------------------
   Responsive: mobilní sidebar jako overlay
   ------------------------------------------------------- */
@media (max-width: 991.98px) {
    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .25s ease;
    }

    #sidebar.show {
        transform: translateX(0);
    }

    #page-content {
        width: 100%;
    }

    #sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 99;
    }

    #sidebar-backdrop.show {
        display: block;
    }
}

/* -------------------------------------------------------
   Tiskový výstup
   ------------------------------------------------------- */
@media print {
    #sidebar,
    .top-bar,
    .btn,
    .no-print,
    footer,
    .alert {
        display: none !important;
    }

    #page-content {
        padding: 0 !important;
    }

    body {
        background: #fff;
        font-size: 11pt;
    }

    .card {
        border: 1px solid #ccc !important;
        break-inside: avoid;
    }

    .print-header {
        display: block !important;
    }
}

.print-header {
    display: none;
}

/* -------------------------------------------------------
   Různé utility
   ------------------------------------------------------- */
.letter-spacing-wide {
    letter-spacing: .3em;
}

.password-strength .bar {
    height: 4px;
    border-radius: 2px;
    transition: width .3s, background .3s;
}

.cursor-pointer { cursor: pointer; }

/* -------------------------------------------------------
   Dropzone (drag & drop upload)
   ------------------------------------------------------- */
.dropzone {
    border: 2px dashed var(--bs-border-color);
    border-radius: var(--card-radius);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.dropzone-active {
    border-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.05);
}
.dropzone .dropzone-placeholder { pointer-events: none; }
.dropzone input[type="file"] { position: absolute; opacity: 0; width: 0; height: 0; }

/* -------------------------------------------------------
   Mobilní optimalizace — responsive tabulky
   ------------------------------------------------------- */
@media (max-width: 767.98px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-responsive table {
        min-width: 600px;
    }
    /* Karty místo tabulky na velmi malých displejích (volitelné) */
    .czlan-table-cards .table thead { display: none; }
    .czlan-table-cards .table tr { display: block; border-bottom: 1px solid var(--bs-border-color); }
    .czlan-table-cards .table td {
        display: block;
        text-align: right;
        padding: 0.5rem;
    }
    .czlan-table-cards .table td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: var(--bs-secondary);
    }
}

/* -------------------------------------------------------
   Detail akce — záložky na mobilu (horizontální scroll)
   ------------------------------------------------------- */
.event-tabs-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}
.event-tabs-scroll .nav-tabs {
    border-bottom: 1px solid var(--bs-border-color);
    min-width: max-content;
}
.event-tabs-scroll .nav-link {
    white-space: nowrap;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 3px; }
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); }
