/* ============================================================================
   NOTE COMPOSER MODAL - Polished Card-Based Layout
   ============================================================================ */

.note-composer-modal {
    width: 980px;
    max-width: calc(100vw - 32px);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.note-composer-modal > h3 {
    flex-shrink: 0;
}

.note-composer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    min-height: 0;
    flex: 1;
}

.note-composer-left,
.note-composer-right {
    min-height: 0;
}

/* Left panel - form controls with card grouping */
.note-composer-left {
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
}

.note-composer-left::-webkit-scrollbar {
    width: 5px;
}

.note-composer-left::-webkit-scrollbar-track {
    background: transparent;
}

.note-composer-left::-webkit-scrollbar-thumb {
    background: var(--sb-thumb);
    border-radius: 3px;
}

.note-composer-left::-webkit-scrollbar-thumb:hover {
    background: var(--sb-thumb-hover);
}

/* Form groups as polished cards */
.note-composer-left .form-group {
    background: color-mix(in srgb, var(--surface-1) 80%, transparent);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    margin-bottom: 10px;
    transition: border-color var(--ui-motion-medium) ease, background-color var(--ui-motion-medium) ease;
}

.note-composer-left .form-group:hover {
    border-color: var(--border-color-hover);
    background: var(--hover-bg);
}

.note-composer-left .form-group:last-child {
    margin-bottom: 0;
}

/* Form group labels - uppercase micro-labels */
.note-composer-left .form-group > label {
    display: block;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

/* Right panel - live preview */
.note-composer-right {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--surface-1);
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
}

.note-composer-preview-header {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-2);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.note-composer-preview-header::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-color);
    opacity: 0.65;
    flex-shrink: 0;
}

.note-composer-preview {
    padding: 14px;
    overflow: auto;
    flex: 1;
    background-image: radial-gradient(circle, var(--border-color) 0.7px, transparent 0.7px);
    background-size: 18px 18px;
    background-position: 9px 9px;
}

.composer-preview-stage {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 0;
}

/* Preview note overrides */
.note-composer-preview .composer-preview-note.note {
    position: relative;
    left: auto !important;
    top: auto !important;
    z-index: auto !important;
    margin: 0;
    transform: none !important;
}

.note-composer-preview .composer-preview-note .note-header {
    cursor: default;
}

.note-composer-preview .composer-preview-note .note-header:active {
    cursor: default;
    background-color: inherit;
}

.note-composer-preview .composer-preview-note .note-title,
.note-composer-preview .composer-preview-note .text-editor,
.note-composer-preview .composer-preview-note .sticky-content,
.note-composer-preview .composer-preview-note .code-editor {
    outline: none;
}

.note-composer-preview .composer-preview-note .text-editor {
    min-height: 70px;
}

.note-composer-preview .composer-preview-note .code-editor {
    min-height: 100%;
}

.note-composer-preview .composer-editable-placeholder:empty::before {
    content: attr(data-placeholder);
    color: rgba(17, 17, 17, 0.45);
    pointer-events: none;
}

.note-composer-preview .composer-editable-placeholder:focus:empty::before {
    color: rgba(17, 17, 17, 0.35);
}

.note-composer-preview .composer-preview-note-checklist .note-body {
    overflow: visible;
}

.note-composer-preview .composer-preview-note .chk-delete-btn {
    opacity: 1;
}

.note-composer-preview .composer-preview-note-sticky {
    overflow: visible;
}

.note-composer-preview .composer-preview-note-code {
    max-width: 100%;
}

.note-composer-preview .composer-preview-note-code .code-editor {
    color: #f8fafc;
}

.note-composer-preview .composer-preview-note-code .line-numbers {
    color: rgba(248, 250, 252, 0.78);
}

.note-composer-preview .composer-preview-note-code .composer-editable-placeholder:empty::before {
    color: rgba(248, 250, 252, 0.65);
}

.note-composer-preview .composer-preview-note-voice {
    min-height: 64px !important;
}

.note-composer-preview .composer-preview-note-voice .voice-play-btn {
    pointer-events: none;
}

/* ============================================================================
   FORM CONTROLS - Color, Grid, Switch, Dropzone
   ============================================================================ */

/* Color input */
.note-composer-color-input {
    padding: 4px !important;
    height: 38px;
    border-radius: var(--radius-md) !important;
    cursor: pointer;
    transition: border-color var(--ui-motion-medium) ease, box-shadow var(--ui-motion-medium) ease;
}

.note-composer-color-input:hover {
    border-color: var(--border-color-hover);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

/* Grid layouts */
.note-composer-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.note-composer-font-field {
    position: relative;
}

.note-composer-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

/* Sub-labels within form groups */
.note-composer-sub-label {
    display: block;
    margin-bottom: 4px;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Inline toggle row */
.note-composer-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* Spinner group in note composer */
#note-composer .input-spinner-group {
    height: 34px;
    min-width: 0;
    width: 100%;
}

#note-composer .input-spinner-group .spinner-btn {
    min-width: 22px;
    padding: 0 4px;
    flex-shrink: 0;
}

#note-composer .input-spinner-group .spinner-value {
    min-width: 24px;
    flex: 1;
}

/* Ensure border grid children don't overflow */
.note-composer-grid-3 > div {
    min-width: 0;
}

/* Compact the style dropdown inside border grid */
.note-composer-grid-3 select {
    width: 100%;
    min-width: 0;
}

/* Toggle switch */
.note-composer-switch {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.note-composer-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.note-composer-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(24, 24, 27, 0.28);
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.note-composer-slider::before {
    content: '';
    width: 18px;
    height: 18px;
    position: absolute;
    top: 3px;
    left: 3px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.note-composer-switch input:checked+.note-composer-slider {
    background: var(--accent-color);
}

.note-composer-switch input:checked+.note-composer-slider::before {
    transform: translateX(20px);
}

/* File dropzone */
.composer-dropzone {
    min-height: 68px;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
    background: var(--surface-1);
    transition: border-color var(--ui-motion-medium) ease, background-color var(--ui-motion-medium) ease, box-shadow var(--ui-motion-medium) ease;
}

.composer-dropzone:hover,
.composer-dropzone.dragover {
    border-color: rgba(var(--accent-rgb), 0.34);
    border-style: solid;
    background: rgba(var(--accent-rgb), 0.06);
    box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.1);
}

.note-composer-confirm-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.note-composer-helper {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    opacity: 0.8;
}

/* Voice recorder */
.voice-recorder-panel {
    background: var(--surface-1);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

#voice-record-status {
    margin-top: 8px;
    font-size: var(--text-sm);
    text-align: center;
    font-weight: 600;
    min-height: 1.2em;
}

#voice-record-waveform {
    display: none;
    width: 100%;
    height: 60px;
    margin-top: 8px;
    background: var(--surface-2);
    border-radius: 4px;
}

/* ============================================================================
   PREVIEW CARD VARIANTS
   ============================================================================ */

.composer-preview-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    min-height: 200px;
    box-shadow: var(--shadow-sm);
}

.composer-preview-headerbar {
    height: 32px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-weight: 600;
    font-size: 0.84rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-2);
}

.composer-preview-body {
    padding: 12px;
    min-height: 164px;
}

.composer-preview-title,
.composer-preview-content,
.composer-preview-plaintext {
    outline: none;
    cursor: text;
}

.composer-preview-title {
    margin-bottom: 8px;
    font-weight: 600;
    min-height: 22px;
}

.composer-preview-content {
    min-height: 100px;
    white-space: pre-wrap;
}

.composer-preview-checklist-card {
    min-height: 220px;
}

.composer-preview-checklist-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 186px;
}

.composer-preview-checklist-body .checklist-container {
    flex: 1;
}

.composer-preview-checklist-body .chk-add-btn {
    margin-top: 0;
}

.composer-preview-checklist-text {
    white-space: pre-wrap;
}

.composer-preview-checklist-item {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 8px;
    align-items: start;
    margin-bottom: 8px;
}

.composer-preview-checklist-dot {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 2px solid rgba(0, 0, 0, 0.45);
    margin-top: 2px;
}

.composer-preview-sticky {
    min-height: 200px;
    border-radius: 8px;
    padding: 14px;
    white-space: pre-wrap;
}

.composer-preview-plaintext {
    min-height: 160px;
    white-space: pre-wrap;
}

.composer-preview-code {
    min-height: 180px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    border-radius: var(--radius-md);
    padding: 10px;
    border: 1px solid var(--border-color);
    white-space: pre-wrap;
}

.composer-preview-image {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface-1);
}

.composer-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.composer-preview-image-placeholder {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.composer-preview-voice {
    min-height: 76px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: rgba(var(--accent-rgb), 0.08);
    border: 1px solid rgba(var(--accent-rgb), 0.16);
}

.composer-preview-voice-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.26);
    flex-shrink: 0;
}

.composer-preview-voice-wave {
    height: 24px;
    flex: 1;
    border-radius: 8px;
    background: repeating-linear-gradient(90deg,
            rgba(255, 255, 255, 0.95),
            rgba(255, 255, 255, 0.95) 4px,
            rgba(255, 255, 255, 0.35) 4px,
            rgba(255, 255, 255, 0.35) 8px);
}

/* ============================================================================
   FOOTER & RESPONSIVE
   ============================================================================ */

.note-composer-modal .btn-group {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* Responsive breakpoints removed — UI zoom (applyUIScale) handles resolution
   scaling by zooming the modal to fit. Fixed-pixel layout ensures the composer
   always looks like the 1080p design regardless of actual viewport size. */

/* ============================================================================
   PREVIEW NOTE POP-IN ANIMATION
   ============================================================================ */

@keyframes composer-note-pop-in {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.04);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.composer-preview-stage.animate-in .composer-preview-note {
    animation: composer-note-pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
