/* assets/css/main.css - layout + chat styles */

* { box-sizing: border-box; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    margin:0; background:#f4f6f8; color:#222;
}

.topbar {
    background:#1e6be0; color:#fff; padding:12px 16px;
}
.topbar-inner { display:flex; align-items:center; justify-content:space-between; max-width:1200px; margin:0 auto; }
.topbar .logo { font-weight:700; }
.topbar .logo span { font-weight:normal; }
.topnav a { color:#fff; text-decoration:none; margin-left:12px; opacity:0.95; }
.topnav a.active { background:rgba(255,255,255,0.15); padding:6px 10px; border-radius:6px; }

.main-grid {
    max-width:1200px; margin:18px auto; display:grid;
    grid-template-columns: 280px 1fr 280px;
    gap:16px; padding:0 12px;
}

.main-grid--editor {
    grid-template-columns: 300px 1fr;
}

.chat-column {
    position: sticky;
    top: 18px;
    height: fit-content;
}

@media (max-width: 1100px) {
    .main-grid {
        grid-template-columns: 280px 1fr;
    }
    .chat-column {
        display: none;
    }
}

.logo span {font-size:80%;font-weight: normal;}

/* Sjednocený styl tlačítek podle vzoru "Smazat větěv" */
.top-btn, .btn {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
}
.material-icons { font-size: 18px; }

.top-btn:hover, .btn:hover {
    filter: brightness(0.95);
    text-decoration: none;
}

/* Varianty barev - zvýšená specificita pomocí body pro jistotu */
body .top-btn.primary, body .btn-primary { /* Uložit / Přidat - zelená */
    background: #e8f5e9;
    border-color: #81c784;
    color: #1b5e20;
}
body .top-btn.primary:hover, body .btn-primary:hover {
    background: #c8e6c9;
    border-color: #66bb6a;
}

body .top-btn.danger, body .btn-danger { /* Smazat - červená */
    background: #ffebee;
    border-color: #e57373;
    color: #b71c1c;
}
body .top-btn.danger:hover, body .btn-danger:hover {
    background: #ffcdd2;
    border-color: #ef5350;
}

body .top-btn.warning, body .btn-warning { /* Přidat / Duplikovat - žlutá */
    background: #fff9c4;
    border-color: #afa550;
    color: #827717;
}
body .top-btn.warning:hover, body .btn-warning:hover {
    background: #fff59d;
    border-color: #ffee58;
}

body .top-btn.secondary, body .btn-secondary { /* Editovat / Akce - modrá */
    background: #e3f2fd;
    border-color: #90caf9;
    color: #0d47a1;
}
body .top-btn.secondary:hover, body .btn-secondary:hover {
    background: #bbdefb;
    border-color: #64b5f6;
}

.btn-neutral { /* Zrušit / Neutrální - šedá */
    background: #f5f5f5;
    border-color: #bdbdbd;
    color: #424242;
}
.btn-neutral:hover {
    background: #eeeeee;
    border-color: #9e9e9e;
}

/* responsive */
@media (max-width: 900px) {
    .main-grid { grid-template-columns: 1fr; }
    .mobile-only { display: block !important; }
    
    /* Sjednocení mobilního nastavení */
    .mobile-container {
        background: #fff;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        margin-bottom: 12px;
        overflow: hidden;
    }
    .mobile-container #sidebar-mobile-toggle.box {
        margin-bottom: 0;
        box-shadow: none;
        border-radius: 0;
    }
    .mobile-container .sidebar-wrapper .box {
        margin-bottom: 0;
        box-shadow: none;
        border-radius: 0;
        border-top: 1px solid #eee;
    }

    .mobile-stack {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
    }
    .mobile-stack-sm {
        flex-direction: column;
        gap: 15px;
    }
    .text-center-mobile {
        text-align: center;
    }
    .shrink-0 {
        flex-shrink: 0;
    }
}

.mobile-only { display: none; }

/* Sidebar and content areas */
.sidebar-content { padding: 10px; }
.sidebar-content h3 { border-top: 1px solid rgba(0,0,0,0.1); padding-top: 20px;margin-top: 20px; }
.content-area { padding: 20px; }
.sidebar-select { font-size: 0.9em; border: 1px solid #ccc; border-radius: 4px; background: white; }
.muted { color: #888; font-size: 0.9em; }

/* Toasts */
.toast { position: fixed; top: 20px; right: 20px; padding: 10px 20px; border-radius: 4px; color: white; z-index: 10000; }
.toast-success { background: #28a745; }
.toast-error { background: #dc3545; }

/* Modals */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; z-index: 9999; }
.modal-backdrop { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; }
.modal-box { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); min-width: 300px; }
.modal-buttons { margin-top: 15px; text-align: right; display: flex; gap: 10px; justify-content: flex-end; }

/* Module Tree Editor */
.tab { display:none; }
.tab.active { display:block; }
.step-block { background: #ffffff; border-radius: 12px; padding: 22px; border: 1px solid #dcdcdc; box-shadow: 0 4px 12px rgba(0,0,0,0.06); margin-bottom: 32px; }
.step-header { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 2px solid #f3f3f3; margin-bottom: 15px; }
.step-id { background: #3f51b5; color: white; padding: 3px 10px; border-radius: 6px; font-family: monospace; font-size: 14px; }
.branches { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.branch-block { background: #fafafa; border: 1px solid #ccc; padding: 16px 18px; border-radius: 10px; position: relative; display: flex; flex-direction: column; }
.branch-block::before { content: ""; width: 6px; height: 100%; position: absolute; left: 0; top: 0; border-radius: 6px 0 0 6px; background: #2196f3; }
.branch-block[data-branch-name="ANO"]::before { background:#4caf50; }
.branch-block[data-branch-name="NE"]::before  { background:#f44336; }
.next-step-wrap { display: flex; align-items: center; gap: 8px; }

/* Dashboard */
.dashboard-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 20px; }
.dashboard-card { background: white; padding: 20px; border-radius: 8px; border: 1px solid #ddd; }
.dashboard-card ul { list-style: none; padding: 0; }
.dashboard-card li { margin-bottom: 8px; }
.dashboard-card a { text-decoration: none; color: #3f51b5; font-weight: bold; }

/* Utility classes to replace inline styles */
.w-full { width: 100%; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mb-5 { margin-bottom: 5px; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.p-4 { padding: 4px; }
.p-6 { padding: 6px; }
.p-8 { padding: 8px; }
.p-10 { padding: 10px; }
.gap-5 { gap: 5px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-20 { gap: 20px; }
.gap-30 { gap: 30px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.h-40 { height: 40px; }
.h-50 { height: 50px; }
.h-60 { height: 60px; }
.h-80 { height: 80px; }
.h-100 { height: 100px; }
.h-600 { height: 600px; }
.fs-16 { font-size: 16px; }
.border-gray { border: 1px solid #ccc; }
.border-bottom-eee { border-bottom: 1px solid #eee; }
.rounded-8 { border-radius: 8px; }
.bg-fafafa { background: #fafafa; }
.border-collapse { border-collapse: collapse; }
.bg-white { background: white; }
.c-white { color: white; }
.inline { display: inline; }
.vertical-middle { vertical-align: middle; }
.fs-18 { font-size: 18px; }
.btn-logout { background: rgba(255,255,255,0.2); color: white; border: none; padding: 5px 10px; cursor: pointer; display: flex; align-items: center; gap: 5px; }
.m-auto { margin: auto; }
.text-right { text-align: right; }
.c-green { color: green; }
.no-decoration { text-decoration: none; }
.bold { font-weight: bold; }

/* sidebar and chat column */
.sidebar { }

/* chat box */
.chat-box { background:#fff; padding:12px; border-radius:10px; box-shadow:0 2px 10px rgba(0,0,0,0.04); }
.chat-history { max-height: 60vh; overflow:auto; padding:8px; display:flex; flex-direction:column; gap:8px; }

/* bubbles */
.bubble { max-width:100%; padding:10px 12px; border-radius:12px; line-height:1.3; }
.bubble-user { align-self:flex-end; background:#1e6be0; color:#fff; border-bottom-right-radius:4px; }
.bubble-assistant { align-self:flex-start; background:#f1f3f5; color:#111; border-bottom-left-radius:4px; }

.chat-form { display:flex; gap:8px; margin-top:10px; align-items:flex-end; }
.chat-form textarea { flex:1; padding:8px; border-radius:8px; border:1px solid #ddd; resize:vertical; min-height:44px; }
.chat-send { padding:10px 12px; background:#1e6be0; color:#fff; border:none; border-radius:8px; cursor:pointer; }

/* small utilities */
.box { margin-bottom:12px; }
