* { box-sizing: border-box; font-family: sans-serif; }
body { margin: 0; padding: 0; background-color: #f4f5f7; height: 100vh; overflow: hidden; }

.hidden { display: none !important; }
.view-container { height: 100vh; width: 100vw; display: flex; flex-direction: column; }

/* Login */
#login-view { justify-content: center; align-items: center; }
.card { background: white; padding: 2rem; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); display: flex; flex-direction: column; gap: 1rem; }

/* Dashboard */
#dashboard-view header { padding: 1rem 2rem; background: white; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #ddd; }
#dashboard-view main { padding: 2rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin-top: 1rem; }

/* Workspace Layout */
.top-bar { height: 50px; background: white; border-bottom: 1px solid #ddd; display: flex; justify-content: flex-start; align-items: center; padding: 0; }
.workspace-layout { display: flex; flex: 1; height: calc(100vh - 50px); }

.left-pane { width: 280px; background: #fff; padding: 1rem; border-right: 1px solid #ddd; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.right-pane { width: 300px; background: #fff; display: flex; flex-direction: column; overflow: hidden; }
.right-pane-content { padding: 1rem; flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.right-pane-footer { height: 70px; border-top: 1px solid #ddd; padding: 0 1rem; display: flex; align-items: center; gap: 5px; flex-shrink: 0; }

.pane-title { margin: 0 0 0.5rem 0; font-size: 1.05rem; font-weight: 700; color: #1a202c; }
.palette-group { margin-bottom: 0.75rem; }
.palette-subtitle { margin: 0 0 0.4rem 0; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: #718096; font-weight: 600; }

.palette-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }

.palette-item {
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.4rem 0.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    transition: all 0.15s ease;
    min-height: 52px;
}

.palette-item:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.palette-item:active { cursor: grabbing; }

.palette-item span {
    font-size: 0.68rem;
    color: #4a5568;
    margin-top: 3px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.item-icon { font-size: 1.1rem; line-height: 1; }

.item-preview {
    font-size: 0.62rem;
    font-weight: 600;
    border: 1px solid #4a5568;
    background: #fff;
    color: #2d3748;
    border-radius: 3px;
    padding: 1px 3px;
    line-height: 1.2;
    display: inline-block;
}

.button-preview { background: #e2e8f0; }
.input-preview { color: #a0aec0; }
.checkbox-preview { border: none; background: transparent; padding: 0; }
.radio-preview { border: none; background: transparent; padding: 0; }
.select-preview { padding-right: 2px; }
.toggle-preview { border-radius: 10px; background: #2d3748; color: #fff; font-size: 0.55rem; padding: 1px 3px; }
.search-preview { border-radius: 10px; font-size: 0.58rem; }
.textarea-preview { line-height: 1; }
.date-preview { font-size: 0.58rem; }

/* Assets Section */
.assets-section { border-top: 1px solid #e2e8f0; padding-top: 0.75rem; }
.assets-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }

.btn-small {
    background: #3182ce;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}
.btn-small:hover { background: #2b6cb0; }

.asset-drop-zone {
    border: 2px dashed #cbd5e0;
    border-radius: 6px;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.72rem;
    color: #718096;
    margin-bottom: 0.75rem;
    background: #f7fafc;
    transition: background 0.2s, border-color 0.2s;
}

.asset-drop-zone.dragover {
    background: #ebf8ff;
    border-color: #3182ce;
    color: #2b6cb0;
}

.asset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.asset-item {
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    cursor: grab;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.asset-item:hover { border-color: #3182ce; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.asset-item img { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: auto; }

.top-bar-left { display: flex; align-items: center; gap: 1rem; width: 280px; padding-left: 1rem; border-right: 1px solid #ddd; box-sizing: border-box; }
.flow-controls { display: flex; gap: 0.5rem; padding-left: 1rem; }
.toolbar { margin-left: auto; padding-right: 1rem; }
.resizer { width: 5px; background: #ddd; cursor: ew-resize; z-index: 10; flex-shrink: 0; }
.resizer:hover, .resizer:active { background: #007bff; }
.flow-controls { display: flex; align-items: center; gap: 0.25rem; }
#flow-selector { padding: 0.25rem; border: 1px solid #cbd5e0; border-radius: 4px; font-size: 0.85rem; }

.flows-control { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; color: #4a5568; font-size: 0.9rem; }
.flows-control button { background: none; border: none; cursor: pointer; font-weight: bold; color: #4a5568; font-size: 1rem; }
.flows-control button:hover { color: #2b6cb0; }
#add-sheet-btn { font-size: 0.8rem; padding: 0.2rem 0.4rem; }

.presence-indicators { display: flex; gap: 0.4rem; }
.presence-badge { 
    width: 24px; height: 24px; border-radius: 50%; 
    background: #3182ce; color: white; 
    display: flex; justify-content: center; align-items: center;
    font-size: 0.7rem; font-weight: bold; cursor: help;
    border: 2px solid white; box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.center-pane { flex: 1; background: #e9ecef; display: flex; flex-direction: column; overflow: hidden; }
.canvas-container { flex: 1; display: flex; overflow: auto; padding: 1rem; }
.canvas-container > div { margin: auto; }
#wireframe-canvas { border: 1px solid #ccc; background: white; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }

/* Filmstrip */
.filmstrip-container {
    height: 70px; background: white; border-top: 1px solid #ddd;
    display: flex; align-items: center; padding: 0 1rem;
    flex-shrink: 0;
}
.filmstrip {
    display: flex; align-items: center; gap: 0.5rem;
    overflow-x: auto; flex: 1; justify-content: flex-start;
    padding: 10px 0; /* Add padding to prevent clipping of absolute X button */
}
.new-slide-btn {
    margin-left: 1rem; flex-shrink: 0;
}
.filmstrip-item {
    width: 50px; height: 50px; background: #f7fafc; border: 1px solid #cbd5e0;
    border-radius: 4px; display: flex; justify-content: center; align-items: center;
    cursor: pointer; font-size: 0.8rem; font-weight: 600; color: #718096;
    transition: all 0.1s ease; position: relative;
}
.filmstrip-item:hover { border-color: #a0aec0; background: #edf2f7; }
.filmstrip-item.active { border-color: #3182ce; background: #ebf8ff; color: #2b6cb0; border-width: 2px; }

.delete-slide-btn {
    position: absolute; top: -5px; right: -5px;
    background: #e53e3e; color: white;
    border: none; border-radius: 50%;
    width: 16px; height: 16px; padding: 0;
    font-size: 10px; line-height: 16px; text-align: center;
    cursor: pointer; display: none;
}
.filmstrip-item:hover .delete-slide-btn { display: block; }

textarea { width: 100%; flex: 1; min-height: 100px; resize: none; border: 1px solid #ccc; padding: 0.5rem; margin-bottom: 0; }

/* Custom Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-content h3 { margin: 0; color: #1a202c; }
.modal-content p { margin: 0; color: #4a5568; font-size: 0.9rem; }
.modal-content input { padding: 0.5rem; border: 1px solid #cbd5e0; border-radius: 4px; font-size: 1rem; }

.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }
.btn-cancel { background: #e2e8f0; color: #4a5568; border: none; padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer; font-weight: 600; }
.btn-cancel:hover { background: #cbd5e0; }
.btn-confirm { background: #3182ce; color: white; border: none; padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer; font-weight: 600; }
.btn-confirm:hover { background: #2b6cb0; }
.btn-danger { background: #e53e3e; color: white; border: none; padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer; font-weight: 600; }
.btn-small.btn-danger { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
.btn-danger:hover { background: #c53030; }

.card-actions { display: flex; gap: 0.5rem; margin-top: auto; flex-wrap: wrap; }

/* Notes Tabs */
.notes-tabs { display: flex; border-bottom: 2px solid #e2e8f0; margin-bottom: 10px; }
.notes-tab {
    background: transparent; border: none; padding: 0.5rem 1rem;
    font-weight: 600; color: #718096; cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -2px; flex: 1;
}
.notes-tab:hover { color: #2b6cb0; }
.notes-tab.active { color: #2b6cb0; border-bottom-color: #3182ce; }
.notes-container { display: flex; flex-direction: column; flex: 1; }
.btn-export { background: #38a169; color: white; border: none; padding: 0.25rem 0.5rem; font-size: 0.75rem; border-radius: 4px; cursor: pointer; font-weight: 600; }
.btn-export:hover { background: #2f855a; }