
@media(max-width:700px){.toolbar{flex-wrap:wrap;gap:8px;}}

/* Global typography */
body{font-family:'Inter',sans-serif;-webkit-font-smoothing:antialiased;}

/* Toolbar - kompakt én-linje layout */
.toolbar{
    display:flex;
    align-items:center;
    gap:4px;
    padding:8px 12px;
    background:#1a1a1a;
    border-bottom:1px solid #333;
    overflow-x:visible;
    overflow-y:visible;
    white-space:nowrap;
    position:relative;
    z-index:9000;
    isolation:isolate;
}

.toolbar-group{
    display:flex;
    align-items:center;
    gap:4px;
}

.toolbar-title{
    gap:12px;
}

.toolbar-title .title{
    font-weight:700;
    font-size:15px;
    color:#fff;
}

.toolbar-title .selected-info{
    font-size:12px;
    color:#aaa;
}

.toolbar-title #selected-label{
    color:#4fc3f7;
    font-weight:600;
}

.toolbar-divider{
    padding-left:8px;
    border-left:1px solid #444;
}

.toolbar-end{
    margin-left:auto;
}

/* Toolbar buttons */
.toolbar button{
    background:#333;
    color:#fff;
    border:none;
    border-radius:4px;
    padding:6px 10px;
    font-size:13px;
    font-weight:600;
    cursor:pointer;
    transition:background .15s,transform .1s;
}

.toolbar button:hover{
    background:#444;
    transform:translateY(-1px);
}

.toolbar button:active{
    transform:translateY(0);
    background:#555;
}

/* Icon buttons (kompakte) */
.toolbar .icon-btn{
    width:32px;
    height:32px;
    padding:0;
    font-size:16px;
    display:flex;
    align-items:center;
    justify-content:center;
}

/* Toggle buttons */
.toolbar .toggle-btn{
    background:#444;
    padding:4px 8px;
    font-size:12px;
}

.toolbar .toggle-btn.active{
    background:#d62839;
}

/* Text buttons */
.toolbar .text-btn{
    padding:6px 12px;
}

/* Danger buttons */
.toolbar button.danger{
    background:#8b0000;
}

.toolbar button.danger:hover{
    background:#a00;
}

/* Dropdown */
.toolbar-dropdown{
    position:relative;
    z-index:9999;
}

.toolbar-dropdown summary{
    list-style:none;
    background:#d62839;
    color:#fff;
    padding:6px 12px;
    border-radius:4px;
    font-size:13px;
    font-weight:600;
    cursor:pointer;
    display:flex;
    align-items:center;
    gap:4px;
}

.toolbar-dropdown summary::-webkit-details-marker{display:none;}

.toolbar-dropdown summary::after{
    content:"▼";
    font-size:10px;
    transition:transform .2s;
}

.toolbar-dropdown[open] summary::after{
    transform:rotate(180deg);
}

.toolbar-dropdown .dropdown-content{
    position:absolute;
    top:100%;
    left:0;
    background:#222;
    border:1px solid #444;
    border-radius:4px;
    padding:4px;
    margin-top:4px;
    z-index:99999;
    display:flex;
    flex-direction:column;
    gap:2px;
    min-width:140px;
    box-shadow:0 4px 12px rgba(0,0,0,.4);
}

.toolbar-dropdown .dropdown-content button{
    width:100%;
    text-align:left;
    background:transparent;
    padding:8px 12px;
}

.toolbar-dropdown .dropdown-content button:hover{
    background:#333;
}


/* Canvas wrapper fix - prevent overlap with side panel and toolbar dropdown */
.canvas-wrapper{
    position:relative !important;
    z-index:1 !important;
    isolation:isolate;
}



.layout-item{
    background:#f9f9f9;
    border:1px solid #ddd;
    border-radius:6px;
    padding:12px;
}

.layout-item-header{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    margin-bottom:4px;
}

.layout-item-name{
    font-weight:600;
    font-size:14px;
}

.layout-item-date{
    font-size:12px;
    color:#666;
}

.layout-item-stats{
    font-size:12px;
    color:#555;
    margin-bottom:8px;
}

.layout-item-actions{
    display:flex;
    gap:8px;
}

.layout-item-actions button{
    padding:6px 12px;
    border:none;
    border-radius:4px;
    font-size:12px;
    font-weight:600;
    cursor:pointer;
}

.layout-item-actions .load-btn{
    background:#28a745;
    color:#fff;
}

.layout-item-actions .load-btn:hover{
    background:#218838;
}

.layout-item-actions .delete-btn{
    background:#dc3545;
    color:#fff;
}

.layout-item-actions .delete-btn:hover{
    background:#c82333;
}

/* Toast notifications */
#toast-container{
    position:fixed;
    bottom:24px;
    right:24px;
    z-index:2000;
    display:flex;
    flex-direction:column;
    gap:8px;
    pointer-events:none;
}

.toast{
    padding:12px 20px;
    border-radius:6px;
    font-size:14px;
    font-weight:500;
    color:#fff;
    box-shadow:0 4px 12px rgba(0,0,0,.2);
    transform:translateX(100%);
    opacity:0;
    transition:transform .3s ease,opacity .3s ease;
    pointer-events:auto;
}

.toast.show{
    transform:translateX(0);
    opacity:1;
}

.toast-info{
    background:#2196f3;
}

.toast-success{
    background:#4caf50;
}

.toast-warning{
    background:#ff9800;
}

.toast-error{
    background:#f44336;
}

/* ============================================
   TOOLBAR - Kompakt layout med direkte adgang
   ============================================ */
.controls{
    display:flex;
    align-items:center;
    gap:6px;
    padding:10px 16px;
    background:#1a1a1a;
    border-bottom:1px solid #333;
    position:sticky;
    top:0;
    z-index:100;
    flex-wrap:wrap;
}

.controls button{
    background:#444;
    color:#fff;
    border:none;
    border-radius:6px;
    padding:8px 12px;
    font-size:14px;
    font-weight:600;
    cursor:pointer;
    transition:all .15s ease;
    flex:0 0 auto;
    min-width:auto;
}

.controls button:hover{
    background:#555;
    transform:translateY(-1px);
}

.controls button:active{
    transform:translateY(0);
    background:#666;
}

/* Icon buttons */
.controls .icon-btn{
    width:36px;
    height:36px;
    padding:0;
    font-size:18px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:6px;
}

/* Text buttons */
.controls .text-btn{
    padding:8px 14px;
}

/* Danger buttons */
.controls button.danger{
    background:#8b0000;
}

.controls button.danger:hover{
    background:#a00;
}

/* Toolbar divider */
.toolbar-divider{
    width:1px;
    height:24px;
    background:#444;
    margin:0 4px;
}

/* Toolbar spacer */
.toolbar-spacer{
    flex:1;
}

/* Zoom display */
.zoom-display{
    background:#333;
    color:#4fc3f7;
    padding:6px 10px;
    border-radius:4px;
    font-size:13px;
    font-weight:600;
    min-width:50px;
    text-align:center;
}

/* Toolbar stats */
.toolbar-stats{
    display:flex;
    gap:16px;
    color:#fff;
    font-size:13px;
    background:#333;
    padding:6px 14px;
    border-radius:4px;
}

.toolbar-stats strong{
    color:#4fc3f7;
    font-size:15px;
}

/* Print info - hidden on screen */
.print-info{
    display:none;
}

/* Dropdown groups */
.controls details.group{
    position:relative;
}

.controls details.group summary{
    list-style:none;
    background:#d62839;
    color:#fff;
    padding:8px 14px;
    border-radius:6px;
    font-size:14px;
    font-weight:600;
    cursor:pointer;
    display:flex;
    align-items:center;
    gap:6px;
    user-select:none;
}

.controls details.group summary::-webkit-details-marker{display:none;}

.controls details.group summary::after{
    content:"▼";
    font-size:10px;
    margin-left:4px;
    transition:transform .2s;
}

.controls details.group[open] summary::after{
    transform:rotate(180deg);
}

.controls details.group.secondary summary{
    background:#555;
}

.controls .dropdown-content{
    position:absolute;
    top:100%;
    left:0;
    background:#222;
    border:1px solid #444;
    border-radius:6px;
    padding:6px;
    margin-top:4px;
    z-index:1000;
    display:flex;
    flex-direction:column;
    gap:2px;
    min-width:160px;
    box-shadow:0 8px 24px rgba(0,0,0,.4);
}

.controls .dropdown-content button{
    width:100%;
    text-align:left;
    background:transparent;
    padding:10px 14px;
    border-radius:4px;
}

.controls .dropdown-content button:hover{
    background:#333;
}

.controls .dropdown-content button.danger{
    color:#ff6b6b;
}

.controls .dropdown-content button.danger:hover{
    background:#3a1a1a;
}

/* ============================================
   VISUAL FEEDBACK - Bedre selection & drag
   ============================================ */

/* Selection pulse animation */
@keyframes selection-pulse{
    0%,100%{outline-color:#d62839;}
    50%{outline-color:#ff6b6b;}
}

.bord-wrapper.selected,
.foh.selected,
.flygel.selected{
    outline:3px solid #d62839;
    outline-offset:4px;
    animation:selection-pulse 1.5s ease-in-out infinite;
    z-index:50;
}

/* Dragging state */
.bord-wrapper.dragging{
    opacity:0.85;
    box-shadow:0 20px 40px rgba(0,0,0,.3);
    z-index:100;
}

/* Grid snap flash */
@keyframes snap-flash{
    0%{box-shadow:0 0 0 0 rgba(214,40,57,.4);}
    100%{box-shadow:0 0 0 15px rgba(214,40,57,0);}
}

.bord-wrapper.snapped{
    animation:snap-flash .3s ease-out;
}

/* Better hover on furniture */
.bord-wrapper:hover .bord{
    background-color:rgba(214,40,57,.08);
}

/* ============================================
   ONBOARDING MODAL
   ============================================ */
.onboarding-overlay{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    display:flex;
    justify-content:center;
    align-items:center;
    background:rgba(0,0,0,.7);
    z-index:2000;
    animation:fadeIn .3s ease;
}

.onboarding-overlay.hidden{
    display:none;
}

@keyframes fadeIn{
    from{opacity:0;}
    to{opacity:1;}
}

.onboarding-content{
    background:#fff;
    padding:32px 40px;
    max-width:500px;
    width:90%;
    border-radius:12px;
    box-shadow:0 20px 60px rgba(0,0,0,.3);
    animation:slideUp .4s ease;
}

@keyframes slideUp{
    from{opacity:0;transform:translateY(30px);}
    to{opacity:1;transform:translateY(0);}
}

.onboarding-content h2{
    margin:0 0 8px 0;
    font-size:24px;
    color:#1a1a1a;
}

.onboarding-intro{
    color:#666;
    margin:0 0 24px 0;
    font-size:15px;
}

.onboarding-steps{
    display:flex;
    flex-direction:column;
    gap:16px;
    margin-bottom:24px;
}

.onboarding-step{
    display:flex;
    gap:14px;
    align-items:flex-start;
    padding:12px;
    background:#f8f8f8;
    border-radius:8px;
}

.step-icon{
    font-size:24px;
    line-height:1;
}

.onboarding-step strong{
    display:block;
    font-size:15px;
    color:#1a1a1a;
    margin-bottom:2px;
}

.onboarding-step p{
    margin:0;
    font-size:13px;
    color:#666;
}

.onboarding-step kbd{
    display:inline-block;
    padding:2px 6px;
    font-size:11px;
    font-family:inherit;
    background:#e0e0e0;
    border:1px solid #ccc;
    border-radius:3px;
    box-shadow:0 1px 0 #999;
}

.onboarding-footer{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding-top:16px;
    border-top:1px solid #eee;
}

.dont-show-again{
    display:flex;
    align-items:center;
    gap:8px;
    font-size:13px;
    color:#666;
    cursor:pointer;
}

.dont-show-again input{
    width:16px;
    height:16px;
    cursor:pointer;
}

.primary-btn{
    background:#d62839;
    color:#fff;
    border:none;
    padding:12px 24px;
    font-size:15px;
    font-weight:600;
    border-radius:6px;
    cursor:pointer;
    transition:all .15s ease;
}

.primary-btn:hover{
    background:#b8222f;
    transform:translateY(-1px);
}

/* ============================================
   MODAL OVERLAY - Fælles styling
   ============================================ */
.modal-overlay{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    display:flex;
    justify-content:center;
    align-items:center;
    background:rgba(0,0,0,.6);
    z-index:1000;
    animation:fadeIn .2s ease;
}

.modal-overlay.hidden{
    display:none;
}

.modal-content{
    background:#fff;
    color:#111;
    padding:0;
    max-width:500px;
    width:90%;
    max-height:85vh;
    border-radius:12px;
    box-shadow:0 20px 60px rgba(0,0,0,.3);
    overflow:hidden;
    display:flex;
    flex-direction:column;
}

.modal-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:16px 20px;
    border-bottom:1px solid #eee;
    background:#f8f8f8;
}

.modal-header h2{
    margin:0;
    font-size:18px;
}

.modal-close{
    background:none;
    border:none;
    font-size:28px;
    color:#666;
    cursor:pointer;
    padding:0;
    line-height:1;
    width:32px;
    height:32px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:4px;
}

.modal-close:hover{
    background:#eee;
    color:#333;
}

.modal-content > div:not(.modal-header){
    padding:20px;
    overflow-y:auto;
}

/* Layouts manager i modal */
.layouts-manager{
    padding:0;
}

.layouts-actions{
    display:flex;
    gap:8px;
    margin-bottom:16px;
}

.layouts-actions input{
    flex:1;
    padding:10px 12px;
    border:2px solid #ddd;
    border-radius:6px;
    font-size:14px;
}

.layouts-actions input:focus{
    outline:none;
    border-color:#d62839;
}

.layouts-actions button{
    background:#d62839;
    color:#fff;
    border:none;
    padding:10px 16px;
    border-radius:6px;
    font-weight:600;
    cursor:pointer;
    white-space:nowrap;
}

.layouts-actions button:hover{
    background:#b8222f;
}

.layouts-list{
    display:flex;
    flex-direction:column;
    gap:8px;
    max-height:300px;
    overflow-y:auto;
}

/* Event info i modal */
.event-info{
    padding:0;
}

.event-fields{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:12px;
}

.event-field{
    display:flex;
    flex-direction:column;
    gap:4px;
}

.event-field.full-width{
    grid-column:1/-1;
}

.event-field label{
    font-size:12px;
    font-weight:600;
    color:#555;
}

.event-field input,
.event-field textarea{
    padding:10px 12px;
    border:2px solid #ddd;
    border-radius:6px;
    font-size:14px;
    font-family:inherit;
}

.event-field input:focus,
.event-field textarea:focus{
    outline:none;
    border-color:#d62839;
}

/* Safety panel i modal */
.safety-panel{
    padding:0;
}

.safety-panel label{
    display:flex;
    flex-direction:column;
    gap:8px;
    font-weight:600;
    font-size:14px;
}

.safety-panel input[type=number]{
    width:120px;
    padding:10px 12px;
    border:2px solid #ddd;
    border-radius:6px;
    font-size:14px;
}

.safety-panel input[type=number]:focus{
    outline:none;
    border-color:#d62839;
}

#exit-width-display{
    margin-top:16px;
    padding:12px 16px;
    background:#e8f5e9;
    border:1px solid #a5d6a7;
    border-radius:6px;
    font-size:14px;
    color:#2e7d32;
}

/* Shortcut list */
.shortcut-list{
    display:flex;
    flex-direction:column;
    gap:10px;
}

.shortcut{
    display:flex;
    align-items:center;
    gap:12px;
    font-size:14px;
}

.shortcut kbd{
    display:inline-block;
    padding:4px 8px;
    font-size:12px;
    font-family:inherit;
    font-weight:600;
    background:#f0f0f0;
    border:1px solid #ccc;
    border-radius:4px;
    box-shadow:0 1px 0 #999;
    min-width:24px;
    text-align:center;
}

.shortcut span{
    color:#555;
}

/* Print styles - sal med info */
@media print{
    @page{
        size:A4 landscape;
        margin:3mm;
    }

    /* Skjul interaktive elementer */
    .controls,
    #toast-container,
    .modal-overlay,
    .rotate-handle{
        display:none !important;
    }

    /* Reset body */
    body{
        background:#fff !important;
        margin:0;
        padding:0;
    }

    /* Canvas wrapper - use scaled height so info follows directly */
    .canvas-wrapper{
        width:100% !important;
        height:var(--print-height) !important;
        padding:0;
        overflow:visible;
        page-break-after:avoid;
    }

    .container{
        transform:scale(var(--print-scale)) !important;
        transform-origin:top left;
        width:max-content;
    }

    /* Salen styling */
    .salen{
        background:#fff !important;
        border:2px solid #000 !important;
        box-shadow:none !important;
        -webkit-print-color-adjust:exact;
        print-color-adjust:exact;
    }

    .scene{
        background:#333 !important;
        color:#fff !important;
        border:2px solid #000 !important;
        border-left:none !important;
        -webkit-print-color-adjust:exact;
        print-color-adjust:exact;
    }

    .exit{
        background:#c00 !important;
        color:#fff !important;
        -webkit-print-color-adjust:exact;
        print-color-adjust:exact;
    }

    .bord-wrapper{
        box-shadow:none !important;
        outline:none !important;
        animation:none !important;
    }

    .bord{
        border:1px solid #000 !important;
        background:#fff !important;
    }

    .stole{
        background:#222 !important;
        color:#fff !important;
        -webkit-print-color-adjust:exact;
        print-color-adjust:exact;
    }

    .flygel, .foh{
        background:#555 !important;
        -webkit-print-color-adjust:exact;
        print-color-adjust:exact;
    }

    /* Print info box */
    .print-info{
        display:block !important;
        width:calc(var(--print-width) - 4px) !important;
        max-width:calc(var(--print-width) - 4px) !important;
        margin-top:0;
        margin-left:2px;
        padding:6px 10px;
        border:2px solid #000;
        border-top:none;
        font-size:9px;
        line-height:1.2;
        box-sizing:border-box;
        page-break-inside:avoid;
        break-inside:avoid;
    }

    .print-info-row{
        display:flex;
        justify-content:space-between;
        align-items:center;
        gap:16px;
    }

    .print-stats{
        display:flex;
        gap:16px;
        font-weight:500;
    }

    .print-stats strong{
        font-size:14px;
    }

    .print-safety{
        color:#333;
    }

    .print-event{
        margin-top:6px;
        display:flex;
        gap:16px;
        flex-wrap:wrap;
    }

    .print-event span:empty{
        display:none;
    }

    .print-event span:not(:empty)::after{
        content:" · ";
        color:#999;
    }

    .print-event span:last-child:not(:empty)::after{
        content:"";
    }

    .print-notes{
        margin-top:4px;
        color:#333;
        font-style:italic;
        font-size:10px;
        word-wrap:break-word;
    }

    .print-notes:empty{
        display:none;
    }

    /* Ensure all print content fits on one page */
    body{
        overflow:visible !important;
        height:auto !important;
    }

    html, body{
        width:100% !important;
        margin:0 !important;
        padding:0 !important;
    }
}

/* Responsive */
@media(max-width:700px){
    .controls{
        gap:4px;
        padding:8px;
    }
    .toolbar-divider{
        display:none;
    }
    .controls .icon-btn{
        width:32px;
        height:32px;
        font-size:16px;
    }
}
