* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: var(--gradient);
    display: flex;
    flex-direction: column;
}

/* ===== NAVBAR STYLES ===== */
.navbar {
    background-color: white !important;
    border-bottom: 3px solid var(--primary-color);
    padding: 0.6rem 0 !important;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.navbar .container-fluid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.navbar-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.navbar-logo-mobile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    flex-shrink: 0;
    margin-right: auto;
}

.logo-navbar {
    height: 32px;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.logo-navbar:hover {
    transform: scale(1.05);
}

.navbar-logo-mobile .btn-xs {
    font-size: 0.66rem;
    padding: 0.3rem 0.3rem;
    height: 26px;
    white-space: normal;
    line-height: 1.2;
}

.navbar-title-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.1rem;
    text-align: center;
    flex: 1;
}

.navbar-title-center h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
    line-height: 1.2;
}

.navbar-title-center p {
    font-size: 0.75rem;
    margin: 0;
    line-height: 1.1;
}

.navbar-title-center .text-muted {
    color: #667eea !important;
    font-weight: 600;
}

.navbar-title-center .text-secondary {
    color: #718096 !important;
}

.navbar-cta {
    flex-shrink: 0;
}

/* ===== OFFCANVAS SIDEBAR (Desktop Only) ===== */
.offcanvas {
    width: 320px !important;
}

.offcanvas-header {
    background: var(--gradient) !important;
    padding: 1rem !important;
}

.offcanvas-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.offcanvas-body {
    background: #f8f9fa;
}

.offcanvas-body .form-label {
    color: #2d3748;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.offcanvas-body .form-control,
.offcanvas-body .form-range {
    border-color: #ddd;
}

.offcanvas-body .form-control:focus,
.offcanvas-body .form-range:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.offcanvas-body .input-group-sm .form-control {
    font-size: 0.9rem;
}

.offcanvas-body .btn-sm {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
}

.offcanvas-body .btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.offcanvas-body .btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.offcanvas-body .btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.offcanvas-body .btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.offcanvas-body .badge {
    font-size: 0.8rem;
    padding: 0.35rem 0.6rem;
}

.offcanvas-body .form-range {
    height: 0.4rem;
}

.offcanvas-body .form-range::-webkit-slider-thumb {
    background: var(--primary-color);
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.offcanvas-body .form-range::-moz-range-thumb {
    background: var(--primary-color);
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ===== MOBILE TOOLBAR ===== */
.mobile-toolbar {
    background: #f8f9fa;
    border-bottom: 2px solid var(--primary-color);
    padding: 0.4rem;
    flex-shrink: 0;
}

.mobile-toolbar-content {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.toolbar-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.toolbar-search {
    flex: 1;
}

.toolbar-search .input-group {
    flex: 1;
}

.toolbar-search .form-control-sm {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    height: 24px;
    background: white;
    border: 1px solid #ddd;
}

.toolbar-search .btn-sm {
    font-size: 0.65rem;
    padding: 0.2rem 0.3rem;
    height: 24px;
    background: white;
    border: 1px solid #ddd;
    color: #333;
}

.toolbar-search .btn-sm:hover {
    background: #e9ecef;
}

.toolbar-export {
    justify-content: space-between;
    gap: 0.3rem;
}

.toolbar-export .btn-md {
    flex: 1;
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
    height: 32px;
    background: var(--primary-color);
    color: white;
    border: none;
}

.toolbar-export .btn-md:hover {
    background: var(--secondary-color);
}

.toolbar-export .btn-secondary {
    background: #6c757d;
}

.toolbar-export .btn-secondary:hover {
    background: #5a6268;
}

/* ===== DESKTOP TOOLBAR ===== */
.desktop-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    flex-shrink: 0;
    background: #f8f9fa;
    border-bottom: 2px solid var(--primary-color);
}

.desktop-toolbar-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.desktop-toolbar .toolbar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.desktop-toolbar .input-group {
    min-width: 200px;
}

.desktop-toolbar .form-control-sm {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    height: 30px;
    background: white;
    border: 1px solid #ddd;
}

.desktop-toolbar .form-control-sm:focus {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.desktop-toolbar .btn-sm {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    height: 30px;
    background: white;
    border: 1px solid #ddd;
    color: #333;
}

.desktop-toolbar .btn-sm:hover {
    background: #e9ecef;
}

.desktop-toolbar .btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.desktop-toolbar .btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

.desktop-toolbar .btn-outline-success {
    color: #28a745;
    border-color: #28a745;
}

.desktop-toolbar .btn-outline-success:hover {
    background: #28a745;
    color: white;
}

.desktop-toolbar .btn-outline-warning {
    color: #ffc107;
    border-color: #ffc107;
}

.desktop-toolbar .btn-outline-warning:hover {
    background: #ffc107;
    color: #333;
}

.desktop-toolbar .btn-outline-info {
    color: #17a2b8;
    border-color: #17a2b8;
}

.desktop-toolbar .btn-outline-info:hover {
    background: #17a2b8;
    color: white;
}

.desktop-toolbar .btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.desktop-toolbar .btn-primary:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

.desktop-toolbar .btn-secondary {
    background: #6c757d;
    border-color: #6c757d;
    color: white;
}

.desktop-toolbar .btn-secondary:hover {
    background: #5a6268;
    border-color: #5a6268;
}

.desktop-toolbar .form-range-sm {
    min-width: 100px;
    height: 0.4rem;
    border-radius: 0.2rem;
    appearance: none;
    -webkit-appearance: none;
    background: linear-gradient(to right, #999 0%, #999 100%);
    outline: none;
}

.desktop-toolbar .form-range-sm::-webkit-slider-runnable-track {
    width: 100%;
    height: 0.4rem;
    background: #999;
    border-radius: 0.2rem;
    border: none;
}

.desktop-toolbar .form-range-sm::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-top: -6px;
}

.desktop-toolbar .form-range-sm::-moz-range-track {
    background: #999;
    border: none;
    border-radius: 0.2rem;
    height: 0.4rem;
}

.desktop-toolbar .form-range-sm::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.desktop-toolbar .badge-sm {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--primary-color);
    color: white;
}

.desktop-toolbar .btn-group-sm > .btn {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    height: 30px;
}

/* ===== MAIN CONTENT ===== */
.main-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    padding: 0.5rem;
    min-height: 0;
    background: var(--gradient);
}

#mindmap {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    flex: 1;
}




/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .navbar-title-center h1 {
        font-size: 1.1rem;
    }

    .navbar-title-center p {
        font-size: 0.7rem;
    }

    .logo-navbar {
        height: 30px;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0.4rem 0 !important;
    }

    .navbar .container-fluid {
        gap: 0.5rem;
        display: flex;
        align-items: flex-start;
    }

    .navbar-logo-mobile {
        margin-right: 0.5rem;
    }

    .navbar-title-center {
        flex: 1;
    }

    .logo-navbar {
        height: 35px;
    }

    .navbar-title-center h1 {
        font-size: 0.95rem;
    }

    .navbar-title-center p {
        font-size: 0.65rem;
    }

    .main-container {
        padding: 0.3rem;
    }

    .mobile-toolbar {
        padding: 0.4rem;
    }

    .mobile-toolbar-content {
        gap: 0.4rem;
    }

    .toolbar-item .form-control-sm {
        font-size: 0.7rem;
        height: 26px;
    }

    .toolbar-item .btn-sm {
        font-size: 0.65rem;
        height: 26px;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0.3rem 0 !important;
    }

    .navbar .container-fluid {
        gap: 0.3rem;
        padding: 0 0.5rem !important;
    }

    .logo-navbar {
        height: 24px;
    }

    .navbar-title-center h1 {
        font-size: 0.85rem;
    }

    .navbar-title-center p {
        font-size: 0.6rem;
    }

    .mobile-toolbar {
        padding: 0.3rem;
    }

    .mobile-toolbar-content {
        gap: 0.3rem;
    }

    .toolbar-item {
        gap: 0.3rem;
    }

    .toolbar-item .form-control-sm {
        font-size: 0.65rem;
        height: 24px;
    }

    .toolbar-item .btn-sm {
        font-size: 0.6rem;
        height: 24px;
        padding: 0.2rem 0.3rem;
    }

    .toolbar-item .btn-group-sm > .btn {
        font-size: 0.6rem;
        height: 24px;
        padding: 0.2rem 0.3rem;
    }
}

/* ===== LANDSCAPE ORIENTATION (Mobile) ===== */
@media (max-height: 500px) and (orientation: landscape) and (max-width: 768px) {
    html, body {
        height: 100vh;
        overflow: hidden;
    }

    .navbar {
        padding: 0.15rem 0 !important;
        flex-shrink: 0;
    }

    .navbar-title-center h1 {
        font-size: 0.75rem;
    }

    .navbar-title-center p {
        font-size: 0.5rem;
    }

    .logo-navbar {
        height: 18px;
    }

    .mobile-toolbar {
        padding: 0.2rem;
        flex-shrink: 0;
    }

    .mobile-toolbar-content {
        gap: 0.2rem;
        flex-direction: row;
    }

    .toolbar-item {
        gap: 0.2rem;
    }

    .toolbar-search {
        flex: 1;
    }

    .toolbar-search .form-control-sm {
        font-size: 0.6rem;
        height: 20px;
        padding: 0.1rem 0.3rem;
    }

    .toolbar-search .btn-sm {
        font-size: 0.55rem;
        height: 20px;
        padding: 0.1rem 0.2rem;
    }

    .toolbar-export {
        gap: 0.2rem;
    }

    .toolbar-export .btn-md {
        font-size: 0.7rem;
        height: 24px;
        padding: 0.2rem 0.4rem;
    }

    .main-container {
        padding: 0.15rem;
        flex: 1;
        min-height: 0;
    }

    #mindmap {
        border-radius: 3px;
    }
}

/* ===== HIGHLIGHTING ===== */
.markmap-node.highlight > text {
    fill: #d53f8c !important;
    font-weight: 700;
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        background: #fff !important;
    }

    header, footer.controls {
        display: none !important;
    }

    #mindmap {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        box-shadow: none !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .markmap-node text {
        fill: #000 !important;
    }

    .markmap-link {
        stroke: #000 !important;
    }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .header-container {
        gap: 0.2rem;
    }
    .topbar { flex-wrap: wrap; gap: 0.35rem; }
    .toolbar.controls-wrapper { order: 3; width: 100%; height: 30px; }

    .header-content {
        text-align: center;
    }

    .header-cta {
        justify-content: center;
    }

    h1 {
        font-size: 0.85rem;
    }

    .controls-wrapper {
        gap: 0.35rem;
    }

    .search-section {
        min-width: 120px;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    header {
        padding: 0.25rem 0.5rem;
    }

    .header-container {
        gap: 0.15rem;
    }

    .topbar {
        gap: 0.3rem;
        flex-wrap: wrap;
    }

    .brand {
        order: 1;
        flex-shrink: 0;
    }

    .toolbar.controls-wrapper {
        order: 3;
        width: 100%;
        height: 28px;
        gap: 0.3rem;
    }

    .header-cta {
        order: 2;
        flex-shrink: 0;
    }

    .logo {
        height: 24px;
    }

    .titleblock h1 {
        font-size: 1.1rem;
    }

    .titleblock {
        padding: 0.2rem 0 0.3rem;
    }

    .titleblock .tagline {
        font-size: 0.8rem;
    }

    .titleblock .subtitle {
        font-size: 0.7rem;
    }

    .controls-section {
        padding: 0;
        height: 24px;
    }

    .topbar .search-section {
        min-width: 110px;
        max-width: 150px;
        height: 24px;
    }

    .search-section input {
        height: 24px;
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }

    .icon-btn {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }

    .export-btn, .view-btn {
        padding: 0.2rem 0.5rem;
        font-size: 0.65rem;
        height: 24px;
    }

    .depth-section label {
        font-size: 0.6rem;
        gap: 0.2rem;
    }

    .depth-value {
        font-size: 0.6rem;
        padding: 0.08rem 0.3rem;
        min-width: 18px;
    }

    .depth-section input[type="range"] {
        width: 70px;
        height: 2px;
    }

    .breadcrumbs {
        max-width: 100%;
        font-size: 0.55rem;
        display: none;
    }

    #mindmap {
        margin: 0.3rem;
        border-radius: 6px;
        min-height: 300px;
    }
}

