:root {
    --bg: #f5f5f5;
    --surface: #ffffff;
    --primary: #3b82f6;
    --text: #171717;
    --border: #ccc;
    --toolbar-bg: #1e1e1e;
    --toolbar-text: #fff;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    margin: 0;
    height: 100vh;
    overflow: hidden;
}

button {
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

button:hover {
    background: #eee;
}

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

button.primary-btn:hover {
    background: #2563eb;
}

.view {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Login */
.login-container {
    margin: auto;
    text-align: center;
    width: 300px;
    background: var(--surface);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.login-container input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
    box-sizing: border-box;
}

.error-msg {
    color: red;
    font-size: 0.9em;
}

/* Dashboard */
.dashboard-header {
    background: var(--surface);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.script-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.script-item {
    background: var(--surface);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
}

.script-item:hover {
    border-color: #999;
}

/* Editor */
.editor-header {
    padding: 15px;
    display: flex;
    gap: 15px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    align-items: center;
}

#editorTitle {
    flex: 1;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text);
    font-size: 1.2em;
    outline: none;
    padding: 5px;
}

#editorTitle:hover,
#editorTitle:focus {
    border-color: var(--border);
}

.color-toolbar {
    padding: 10px;
    background: #eee;
    display: flex;
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.speaker-group {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #fff;
    padding: 2px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.speaker-input {
    border: none;
    background: transparent;
    font-size: 14px;
    width: 80px;
    text-align: center;
    outline: none;
    font-weight: 500;
}

.speaker-input:focus {
    background: #f0f0f0;
}

.editor-content {
    flex: 1;
    padding: 40px;
    font-size: 18px;
    line-height: 1.6;
    outline: none;
    overflow-y: auto;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    color: #000;
}

/* --- Prompter NEW UI --- */
#view-prompter {
    background: #000;
}

.prompter-toolbar {
    background: var(--toolbar-bg);
    color: var(--toolbar-text);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    height: 60px;
    box-sizing: border-box;
    z-index: 100;
    font-size: 14px;
}

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

.toolbar-divider {
    width: 1px;
    height: 30px;
    background: #444;
    margin: 0 5px;
}

.toolbar-spacer {
    flex: 1;
}

/* Inputs in toolbar */
.input-group {
    background: #333;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #444;
}

.input-group input {
    background: transparent;
    border: none;
    color: white;
    width: 40px;
    text-align: center;
    font-size: 14px;
    outline: none;
}

.input-group i {
    color: #aaa;
    font-size: 18px;
}

/* Buttons in toolbar */
.tool-btn {
    background: #333;
    border: 1px solid #444;
    color: white;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 4px;
    font-size: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
}

.tool-btn:hover {
    background: #444;
}

.tool-btn.success {
    background: #10b981;
    /* Green */
    border-color: #059669;
}

.tool-btn.success:hover {
    background: #059669;
}

.tool-btn.danger {
    background: #ef4444;
    /* Red */
    border-color: #dc2626;
}

.tool-btn.danger:hover {
    background: #dc2626;
}

.tool-btn.close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #888;
}

.tool-btn.close-btn:hover {
    color: white;
    background: #333;
}

/* Toggles */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #ccc;
}

.toggle-switch input {
    display: none;
}

.slider {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
    background-color: #333;
    border-radius: 20px;
    transition: .4s;
    border: 1px solid #555;
    flex-shrink: 0;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(14px);
}

/* Timer */
.timer-display {
    font-family: monospace;
    font-size: 18px;
    color: white;
    font-weight: bold;
}

/* Paragraph Counter */
.paragraph-counter {
    font-family: monospace;
    font-size: 16px;
    color: #10b981;
    font-weight: bold;
    background: #1a3a2e;
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid #10b981;
}

/* Prompter Area */
#prompter-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: black;
    color: white;
    transition: transform 0.3s;
}

/* CSS Transforms for Mirror/Flip */
#prompter-container.flipped-x {
    transform: scaleX(-1);
}

#prompter-container.flipped-y {
    transform: scaleY(-1);
}

#prompter-container.flipped-xy {
    transform: scale(-1, -1);
}

#prompter-text {
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    text-align: left;
    /* Aligned left as requested */
    line-height: 1.5;
    white-space: pre-wrap;
    padding-bottom: 80vh;
    font-weight: 400;
    /* Regular */
    color: white;
    transition: transform 0.3s ease-out;
}

/* Markers: Triangles on sides */
.marker-left,
.marker-right {
    position: absolute;
    top: 50%;
    width: 0;
    height: 0;
    margin-top: -60px;
    /* Centering adjustment based on height */
    border-top: 60px solid transparent;
    border-bottom: 60px solid transparent;
    z-index: 10;
    opacity: 0.9;
    /* More visible (less transparent) */
    pointer-events: none;
}

.marker-left {
    left: 0;
    border-left: 100px solid rgba(255, 255, 255, 0.4);
    border-right: none;
}

.marker-right {
    right: 0;
    border-right: 100px solid rgba(255, 255, 255, 0.4);
    border-left: none;
}

/* Force font-size and line-height, color handled by JS */
#prompter-text * {
    font-size: inherit !important;
    line-height: inherit !important;
}

/* Hide ONLY manual paragraph markers (div.paragraph-marker) */
#prompter-text div.paragraph-marker[data-marker="paragraph"] {
    visibility: hidden;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

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

.modal-content {
    background: white;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    min-width: 300px;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.modal.hidden {
    display: none !important;
}

/* Toast Notification */
.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 16px;
    position: fixed;
    z-index: 3000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.5s, bottom 0.5s;
}

.toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 50px;
}

/* Color Buttons specific styles */
.color-btn-white {
    background: white;
    color: black;
    border: 1px solid #ccc;
}

.color-btn-yellow {
    background: #ffd500;
    color: black;
}

.color-btn-green {
    background: #00ff00;
    color: black;
}

.helper-text {
    margin-left: auto;
}