* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    background: #f4f6f8;
    color: #1f2937;
}


/* LOGIN */

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 390px;
    background: #ffffff;
    border-radius: 14px;
    padding: 38px;
    box-shadow: 0 10px 35px rgba(0,0,0,.10);
}

.brand {
    font-size: 30px;
    font-weight: 750;
}

.login-subtitle {
    color: #6b7280;
    margin-top: 4px;
    margin-bottom: 30px;
}

.login-card label {
    display: block;
    margin: 16px 0 6px;
    font-size: 14px;
    font-weight: 600;
}

.login-card input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
}

.login-card button {
    width: 100%;
    margin-top: 24px;
    padding: 12px;
    border: 0;
    border-radius: 8px;
    background: #111827;
    color: white;
    font-size: 16px;
}

.login-error {
    margin-bottom: 16px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fee2e2;
    color: #991b1b;
}


/* APP */

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 240px;
    min-height: 100vh;
    background: #111827;
    color: white;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    font-size: 23px;
    font-weight: 750;
    padding: 0 12px 28px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-nav a {
    text-decoration: none;
    color: #9ca3af;
    padding: 11px 12px;
    border-radius: 8px;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: #1f2937;
    color: white;
}

.sidebar-bottom {
    margin-top: auto;
    border-top: 1px solid #374151;
    padding: 20px 12px 0;
}

.sidebar-bottom .user-name {
    font-weight: 600;
}

.sidebar-bottom a {
    color: #9ca3af;
    text-decoration: none;
    font-size: 14px;
}

.main-content {
    flex: 1;
    padding: 42px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-header h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 700;
}

.page-header p {
    margin: 5px 0 0;
    color: #6b7280;
}

.system-status {
    background: white;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    margin-right: 6px;
}

.stat-card,
.content-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.stat-card {
    padding: 24px;
}

.stat-title {
    color: #6b7280;
    font-size: 14px;
}

.stat-value {
    margin-top: 6px;
    font-size: 30px;
    font-weight: 700;
}

.stat-ok {
    color: #16a34a;
}

.content-card {
    padding: 26px;
}

.content-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-card-header h2 {
    margin: 0;
    font-size: 20px;
}

.content-card-header p {
    margin: 4px 0 0;
    color: #6b7280;
    font-size: 14px;
}

.empty-state {
    margin-top: 30px;
    padding: 45px;
    border: 1px dashed #d1d5db;
    border-radius: 10px;
    text-align: center;
    color: #6b7280;
}


/* PROJECT ACTIONS */

.project-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    margin-left: 4px;

    border: 0;
    border-radius: 7px;

    background: transparent;
    color: #4b5563;

    text-decoration: none;
    font-size: 18px;
    line-height: 1;

    cursor: pointer;
}

.project-action:hover {
    background: #f3f4f6;
    color: #111827;
}

.project-action-danger:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.modal-content {
    border: 0;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,.15);
}


/* PROJECT INSPECTOR */

.project-stat {
    margin-top: 8px;
    font-size: 30px;
    font-weight: 700;
    color: #111827;
}

.project-stat-small {
    font-size: 24px;
}

.project-info-table th {
    width: 180px;
    color: #6b7280;
    font-weight: 500;
}

.project-info-table td,
.project-info-table th {
    padding-top: 14px;
    padding-bottom: 14px;
}

.project-info-table code {
    color: #1f6fc4;
}


/* ============================================================
   FILE BROWSER
   ============================================================ */

.project-add-card {
    max-width: 1100px;
}

.file-browser {
    border: 1px solid #d8dee7;
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
}

.file-browser-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 16px 18px;

    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.file-browser-root {
    margin-top: 2px;
    font-size: 13px;
    color: #6b7280;
}

.directory-tree {
    min-height: 260px;
    max-height: 520px;
    overflow: auto;

    padding: 10px 0;
}

.tree-node {
    display: block;
}

.tree-row {
    display: flex;
    align-items: center;

    min-height: 38px;

    padding-right: 12px;
}

.tree-row:hover {
    background: #f8fafc;
}

.tree-row-selected {
    background: #eef4ff !important;
}

.tree-toggle {
    flex: 0 0 38px;

    width: 38px;
    height: 38px;

    border: 0;
    background: transparent;

    color: #6b7280;

    font-size: 25px;
    line-height: 1;

    cursor: pointer;
}

.tree-toggle:disabled {
    cursor: default;
}

.tree-folder {
    flex: 1;

    display: flex;
    align-items: center;
    gap: 9px;

    min-width: 0;
    height: 38px;

    padding: 0 8px;

    border: 0;
    background: transparent;

    color: #1f2937;

    text-align: left;
    cursor: pointer;
}

.tree-folder:disabled {
    color: #9ca3af;
    cursor: default;
}

.tree-folder-icon {
    color: #64748b;
    font-size: 16px;
}

.tree-folder-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-children {
    margin-left: 27px;
    padding-left: 10px;

    border-left: 1px solid #e5e7eb;
}

.tree-badge {
    margin-left: auto;

    padding: 3px 7px;

    border-radius: 5px;

    background: #f3f4f6;
    color: #6b7280;

    font-size: 11px;
    font-weight: 600;
}

.tree-badge-system {
    background: #111827;
    color: white;
}

.browser-loading,
.tree-empty,
.tree-error {
    padding: 14px 18px;
    color: #6b7280;
    font-size: 14px;
}

.tree-loading {
    padding-left: 10px;
}

.tree-error {
    color: #b91c1c;
}

.selected-directory {
    margin-top: 16px;

    padding: 14px 16px;

    border-radius: 8px;
    background: #f8fafc;
}

.selected-directory-label {
    margin-bottom: 4px;

    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.selected-directory-path {
    color: #111827;
    font-family: monospace;
    font-size: 14px;
}



/* ============================================================
   PROJECT WORKSPACE
   ============================================================ */

.project-workspace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.project-tabs {
    border-bottom: 1px solid #dfe3e8;
}

.project-tabs .nav-link {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;

    padding: 12px 18px;

    color: #667085;
    font-weight: 600;
}

.project-tabs .nav-link.active {
    color: #111827;
    background: transparent;
    border-bottom-color: #111827;
}


/* FILE WORKSPACE */

.project-file-browser {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);

    min-height: 650px;

    border: 1px solid #dfe3e8;
    border-radius: 12px;

    overflow: hidden;
    background: white;
}

.project-file-tree-panel {
    border-right: 1px solid #dfe3e8;
    min-width: 0;
}

.project-file-panel-header {
    padding: 15px 16px;

    border-bottom: 1px solid #dfe3e8;
    background: #f8fafc;
}

.project-file-tree {
    height: 610px;
    overflow: auto;

    padding: 8px 0;
}

.pf-node {
    display: block;
}

.pf-row {
    display: flex;
    align-items: center;

    min-height: 34px;
}

.pf-row:hover {
    background: #f8fafc;
}

.pf-row-selected {
    background: #eef4ff !important;
}

.pf-toggle {
    flex: 0 0 30px;

    width: 30px;
    height: 34px;

    border: 0;
    background: transparent;

    color: #667085;
    font-size: 21px;
}

.pf-name {
    flex: 1;

    display: flex;
    align-items: center;
    gap: 7px;

    min-width: 0;
    height: 34px;

    padding: 0 8px 0 2px;

    border: 0;
    background: transparent;

    color: #273142;
    text-align: left;
}

.pf-name span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pf-name:disabled {
    opacity: .55;
}

.pf-icon {
    flex: 0 0 18px;
    color: #64748b;
}

.pf-children {
    margin-left: 20px;

    border-left: 1px solid #e5e7eb;
}


/* PREVIEW */

.project-file-preview {
    min-width: 0;

    display: flex;
    flex-direction: column;

    background: #fff;
}

.project-file-preview-header {
    min-height: 64px;

    padding: 13px 18px;

    border-bottom: 1px solid #dfe3e8;
    background: #f8fafc;
}

.project-file-preview-meta {
    margin-top: 3px;

    color: #667085;
    font-size: 12px;
}

.project-preview-empty {
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 1;

    padding: 30px;

    color: #98a2b3;
}



/* ==========================================================
   PROJECT FILE EDITOR
   ========================================================== */

.project-file-editor {
    width: 100%;
    min-height: 650px;
    height: 650px;

    margin: 0;
    padding: 22px 24px;

    border: 0;
    border-radius: 0;

    resize: vertical;

    overflow: auto;

    background: #111827;
    color: #39ff4a;

    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Monaco,
        Consolas,
        "Liberation Mono",
        "Courier New",
        monospace;

    font-size: 15px;
    line-height: 1.55;

    white-space: pre;
    tab-size: 4;

    outline: none;
    box-shadow: none;
}

.project-file-editor:focus {
    background: #111827;
    color: #39ff4a;

    outline: none;
    box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.35);
}

.project-preview-code {
    flex: 1;

    height: 585px;
    margin: 0;

    overflow: auto;

    padding: 20px;

    background: #111827;
    color: #39ff4a;

    font-size: 15px;
    line-height: 1.55;

    white-space: pre;
    tab-size: 4;
}


@media (max-width: 1000px) {

    .project-file-browser {
        grid-template-columns: 280px minmax(0, 1fr);
    }

}


/* ============================================================
   PROJECT PERMISSIONS
   ============================================================ */

.permissions-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 25px;
}

.permission-safety-badge {
    padding: 6px 10px;

    border-radius: 6px;

    background: #f3f4f6;
    color: #667085;

    font-size: 12px;
    font-weight: 600;

    white-space: nowrap;
}

.permission-root {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 14px 16px;

    border: 1px solid #dfe3e8;
    border-radius: 8px 8px 0 0;

    background: #f8fafc;
}

.permission-root-name {
    font-weight: 700;
}

.permission-root-status {
    color: #667085;
    font-size: 13px;
    font-weight: 600;
}

.permission-tree {
    border-left: 1px solid #dfe3e8;
    border-right: 1px solid #dfe3e8;
    border-bottom: 1px solid #dfe3e8;

    border-radius: 0 0 8px 8px;

    overflow: hidden;
}

.permission-node {
    display: block;
}

.permission-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 48px;

    padding: 5px 12px;

    border-bottom: 1px solid #eef0f3;
}

.permission-row:hover {
    background: #f8fafc;
}

.permission-left {
    display: flex;
    align-items: center;

    min-width: 0;
}

.permission-toggle {
    width: 30px;
    height: 34px;

    border: 0;
    background: transparent;

    color: #667085;

    font-size: 21px;
}

.permission-folder {
    width: 24px;
    color: #64748b;
}

.permission-name {
    cursor: pointer;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.permission-right {
    display: flex;
    align-items: center;
    gap: 15px;

    margin-left: 20px;
}

.permission-state {
    min-width: 105px;

    font-size: 13px;
    font-weight: 600;

    text-align: right;
}

.permission-readonly {
    color: #667085;
}

.permission-write {
    color: #157347;
}

.permission-inherited {
    color: #7c5c00;
}

.permission-button {
    min-width: 125px;
}

.permission-children {
    margin-left: 28px;

    border-left: 1px solid #e5e7eb;
}

.permission-note {
    margin-top: 20px;

    padding: 14px 16px;

    border-radius: 8px;

    background: #f8fafc;
    color: #667085;

    font-size: 13px;
    line-height: 1.5;
}



/* ==========================================================
   PROJECT LIST - CLICKABLE PROJECT NAME
   ========================================================== */

.project-name-link {
    color: inherit;
    text-decoration: none;
    transition:
        color 0.15s ease,
        text-decoration-color 0.15s ease;
}

.project-name-link:hover {
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 4px;
}



.sidebar-version {
    margin-bottom: 10px;
    font-size: 12px;
    opacity: 0.55;
    letter-spacing: 0.04em;
}


/* ==========================================================
   DEVELOPER primary blue
   ========================================================== */

:root {
    --developer-blue: #1f6fc4;
    --developer-blue-hover: #185ca5;
}

.btn-primary {
    background-color: var(--developer-blue);
    border-color: var(--developer-blue);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--developer-blue-hover);
    border-color: var(--developer-blue-hover);
}

.project-open-button {
    min-width: 120px;
    font-weight: 600;
    text-decoration: none;
}

/* starý textový odkaz projektu už nepoužíváme */
.project-name-link {
    color: inherit;
}

/* DEVELOPER BLUE THEME */
a,
code {
    color: #1f6fc4;
}

.btn-primary,
.project-open-button {
    color: #ffffff !important;
    background: #1f6fc4 !important;
    border-color: #1f6fc4 !important;
}

.btn-primary:hover,
.project-open-button:hover {
    color: #ffffff !important;
    background: #185ca5 !important;
    border-color: #185ca5 !important;
}

/* ==========================================================
   DEVELOPER BLUE LAYOUT
   ========================================================== */

/* Levý hlavní panel */
.sidebar {
    background: #1f6fc4 !important;
}

/* Navigace */
.sidebar-nav a {
    color: rgba(255, 255, 255, 0.82) !important;
}

.sidebar-nav a:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.10) !important;
}

.sidebar-nav a.active {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.16) !important;
}

/* Spodní část sidebaru */
.sidebar-bottom {
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

.sidebar-bottom a,
.sidebar-bottom .user-name {
    color: #ffffff !important;
}

.sidebar-version {
    color: rgba(255, 255, 255, 0.75) !important;
}

/* LOGIN - celé pozadí modré */
.login-page,
body.login-page {
    background: #1f6fc4 !important;
}

/* LOGIN BUTTON - DEVELOPER BLUE */
.login-card button,
.login-card .btn,
.login-form button,
.login-form .btn {
    background: #1f6fc4 !important;
    border-color: #1f6fc4 !important;
    color: #ffffff !important;
}

.login-card button:hover,
.login-card .btn:hover,
.login-form button:hover,
.login-form .btn:hover {
    background: #185ca5 !important;
    border-color: #185ca5 !important;
    color: #ffffff !important;
}

/* ==========================================================
   FILE VIEWER / EDITOR - FIXED HEIGHT + SCROLL
   ========================================================== */

.project-preview-code {
    height: 600px !important;
    max-height: 600px !important;
    overflow: auto !important;
    white-space: pre !important;
}

.project-file-editor {
    height: 600px !important;
    min-height: 600px !important;
    max-height: 600px !important;
    overflow: auto !important;
    resize: none !important;
    white-space: pre !important;
}

/* ==========================================================
   SIDEBAR - WHITE PANEL + BLUE BUTTONS
   ========================================================== */

.sidebar {
    background: #ffffff !important;
}

/* DEVELOPER logo */
.sidebar-brand {
    color: #1f6fc4 !important;
}

/* Navigacni tlacitka */
.sidebar-nav a {
    display: block !important;
    margin: 0 16px 14px 16px !important;
    padding: 13px 18px !important;

    background: #2589df !important;
    color: #ffffff !important;

    border-radius: 6px !important;
    text-decoration: none !important;
    font-weight: 600 !important;

    transition:
        background-color 0.15s ease,
        transform 0.15s ease !important;
}

.sidebar-nav a:hover {
    background: #1f6fc4 !important;
    color: #ffffff !important;
}

/* Aktivni stranka */
.sidebar-nav a.active {
    background: #1768b5 !important;
    color: #ffffff !important;
}

/* Spodni cast */
.sidebar-bottom {
    color: #1f2937 !important;
    border-color: #d8dee7 !important;
}

.sidebar-bottom .user-name {
    color: #1f2937 !important;
}

.sidebar-bottom a {
    color: #1f6fc4 !important;
}

.sidebar-version {
    color: #6b7280 !important;
}


/* ==========================================================
   SIDEBAR FINAL COMPACT LAYOUT
   ========================================================== */

/* Logo + uživatel */
.sidebar-brand {
    padding: 0 16px 24px !important;
}

.sidebar-brand-title {
    color: #1f6fc4 !important;
    font-size: 23px !important;
    font-weight: 750 !important;
    line-height: 1.2 !important;
}

.sidebar-brand-user {
    margin-top: 6px !important;
    color: #6b7280 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}

/* Kompaktní navigační tlačítka */
.sidebar-nav a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    min-height: 0 !important;
    height: 42px !important;

    margin: 0 16px 12px 16px !important;
    padding: 0 14px !important;

    background: #2589df !important;
    color: #ffffff !important;

    border-radius: 6px !important;
    text-align: center !important;
    text-decoration: none !important;
    font-weight: 600 !important;
}

/* Logout vypadá stejně jako ostatní */
.sidebar-nav .sidebar-logout {
    background: #2589df !important;
    color: #ffffff !important;
}

.sidebar-nav .sidebar-logout:hover {
    background: #1f6fc4 !important;
}

/* Dole už jen verze */
.sidebar-bottom {
    margin-top: auto !important;
    padding: 18px 16px 0 !important;
    text-align: center !important;
}

.sidebar-version {
    margin: 0 !important;
    color: #9ca3af !important;
    font-size: 12px !important;
    text-align: center !important;
}


/* ==========================================================
   FILE VIEWER / EDITOR - VISIBLE SCROLLBAR
   ========================================================== */

.project-preview-code,
.project-file-editor {
    scrollbar-width: auto;
    scrollbar-color: #64748b #111827;
}

.project-preview-code::-webkit-scrollbar,
.project-file-editor::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

.project-preview-code::-webkit-scrollbar-track,
.project-file-editor::-webkit-scrollbar-track {
    background: #111827;
}

.project-preview-code::-webkit-scrollbar-thumb,
.project-file-editor::-webkit-scrollbar-thumb {
    background: #64748b;
    border: 3px solid #111827;
    border-radius: 8px;
}

.project-preview-code::-webkit-scrollbar-thumb:hover,
.project-file-editor::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


/* ==========================================================
   FILE VIEWER / EDITOR - CUSTOM VERTICAL SCROLLBAR
   ========================================================== */

.project-code-scroll-wrapper {
    position: relative;
}

.project-code-scrollbar {
    position: absolute;

    top: 8px;
    right: 5px;
    bottom: 8px;

    width: 12px;

    background: #263244;
    border-radius: 8px;

    z-index: 20;
}

.project-code-scrollbar-thumb {
    position: absolute;

    top: 0;
    left: 2px;
    right: 2px;

    min-height: 45px;

    background: #94a3b8;
    border-radius: 7px;

    cursor: grab;
}

.project-code-scrollbar-thumb:hover {
    background: #cbd5e1;
}

.project-code-scrollbar-thumb:active {
    cursor: grabbing;
}

.code-scroll-dragging {
    user-select: none;
}

.project-preview-code,
.project-file-editor {
    padding-right: 28px !important;
}


/* ============================================================
   VETSI STAVOVE BADGE
   ============================================================ */

.status-badge {
    font-size: 15px;
    font-weight: 400;
    padding: 8px 13px;
    line-height: 1;
    border-radius: 9px;
    white-space: nowrap;
}

/* ============================================================
   DOCKER LOG
   ============================================================ */

.docker-log {
    height: 420px;
    overflow: auto;
    margin: 0;
    padding: 16px;
    border-radius: 9px;
    background: #111827;
    color: #e5e7eb;
    font-size: 13px;
    line-height: 1.45;
    white-space: pre;
}
