/* Layout overrides — annotation-online.html only (linked after components.css) */

html.annotation-online-root {
    height: 100%;
    min-height: 100vh;
}

body.annotation-online-body {
    height: 100%;
    min-height: 100vh;
    margin: 0;
}

.annotation-online-body {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Top toolbar — title, CPU note (flex), auth + how-to on the right */
.online-toolbar {
    width: 100%;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    padding: 8px 16px;
}

.online-toolbar-inner {
    display: flex;
    align-items: center;
    gap: 16px 20px;
    flex-wrap: wrap;
    max-width: none;
    width: 100%;
}

.online-toolbar-brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex-shrink: 0;
}

.online-toolbar-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.online-toolbar-sub {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.online-cpu-note {
    flex: 1 1 200px;
    min-width: 0;
    font-size: 0.78rem;
    color: #ffc107;
    line-height: 1.35;
    margin: 0;
}

.online-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
    margin-left: auto;
}

.toolbar-username {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--accent-primary);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-toolbar-auth {
    width: auto !important;
    margin: 0 !important;
    padding: 8px 14px !important;
    white-space: nowrap;
}

.btn-marquee-active {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.35);
    color: var(--accent-primary) !important;
}

[data-theme="light"] .btn-marquee-active {
    box-shadow: 0 0 0 2px rgba(9, 105, 218, 0.28);
}

.btn-howto {
    width: auto !important;
    margin: 0 !important;
    padding: 8px 16px !important;
    white-space: nowrap;
}

/* Auth modal */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.auth-modal.is-open {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    cursor: pointer;
}

.auth-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: min(90vh, 560px);
    overflow-y: auto;
    background: var(--gradient-bg);
    border: 1px solid var(--border-primary);
    border-radius: 14px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
    z-index: 1;
}

.auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-primary);
}

.auth-modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.auth-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 4px;
}

.auth-modal-close:hover {
    color: var(--accent-primary);
}

.auth-modal-body {
    padding: 18px 20px 22px;
}

.auth-modal-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.auth-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.auth-modal-actions .btn {
    flex: 1 1 auto;
    min-width: 120px;
    margin-bottom: 0 !important;
}

.auth-modal-message {
    display: none;
}

[data-theme="light"] .auth-modal-dialog {
    background: var(--bg-primary);
}

/* Workspace: control panel LEFT, image RIGHT */
.online-workspace {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    min-height: 0;
    width: 100%;
}

.annotation-online-body .control-panel {
    order: 1;
    width: 300px;
    flex-shrink: 0;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
    border-right: 1px solid var(--border-primary);
    margin: 0;
    overflow-y: auto;
    max-height: none;
    align-self: stretch;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.55) var(--bg-tertiary);
}

/* WebKit：暗色下避免默认浅色/白边滚动条 */
.annotation-online-body .control-panel::-webkit-scrollbar {
    width: 8px;
}

.annotation-online-body .control-panel::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.annotation-online-body .control-panel::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.45);
    border-radius: 4px;
    border: 2px solid var(--bg-tertiary);
}

.annotation-online-body .control-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.75);
}

[data-theme="light"] .annotation-online-body .control-panel {
    scrollbar-color: #afb8c1 var(--bg-secondary);
}

[data-theme="light"] .annotation-online-body .control-panel::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

[data-theme="light"] .annotation-online-body .control-panel::-webkit-scrollbar-thumb {
    background: #afb8c1;
    border-color: var(--bg-secondary);
}

[data-theme="light"] .annotation-online-body .control-panel::-webkit-scrollbar-thumb:hover {
    background: #8c959f;
}

.annotation-online-body .annotation-panel {
    order: 2;
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border-top: none;
    border-right: none;
    border-bottom: none;
    margin: 0;
    padding: 12px 16px;
}

.annotation-online-body .image-container {
    flex: 1 1 0%;
    min-height: 320px;
    height: auto;
    width: 100%;
}

/* Floating examples inside image area */
.example-images-floating {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    z-index: 25;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}

.example-images-floating .example-floating-inner {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(10, 10, 10, 0.72);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(139, 92, 246, 0.35);
    max-width: 100%;
}

[data-theme="light"] .example-images-floating .example-floating-inner {
    background: rgba(255, 255, 255, 0.88);
    border-color: var(--border-primary);
}

.example-floating-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    margin: 0;
}

.example-images-floating .example-images-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.example-images-floating .example-image {
    width: 72px;
    height: 72px;
    margin: 0;
}

.example-images-floating.examples-floating-hidden {
    display: none !important;
}

@media (max-width: 1200px) {
    .online-workspace {
        flex-direction: column;
    }

    .annotation-online-body .control-panel {
        order: 1;
        width: 100%;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border-primary);
    }

    .annotation-online-body .annotation-panel {
        order: 2;
        flex: 1;
        min-height: 50vh;
    }
}

@media (max-width: 768px) {
    .online-toolbar-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .online-toolbar-actions {
        margin-left: 0;
        justify-content: flex-end;
        width: 100%;
    }

    .online-cpu-note {
        order: 0;
    }

    .btn-howto,
    .btn-toolbar-auth {
        flex: 1 1 auto;
        min-width: 0;
    }

    .example-images-floating .example-image {
        width: 56px;
        height: 56px;
    }
}
