/* ============================================================
   SHARED STYLES - ChoiceMap
   Common styles used across scenario-editor and theme-editor
   ============================================================ */

/* ============================================================
   BASE RESET & TYPOGRAPHY
   ============================================================ */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: #1f2937;
    min-height: 100vh;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.editor-container {
    display: flex;
    height: 100vh;
    position: relative;
}

.sidebar {
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-header h1 {
    font-size: 1.25rem;
    margin: 0 0 0.5rem 0;
    color: #111827;
}

.sidebar-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: #6366f1;
    color: white;
}

.btn-primary:hover {
    background: #5558e3;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-success {
    background: #10b981;
    color: white;
}

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

.btn-danger {
    background: #ef4444;
    color: white;
    text-transform: uppercase;
    font-weight: 600;
}

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

.btn-close {
    background: #ef4444;
    color: white;
    text-transform: uppercase;
    font-weight: 600;
}

.btn-close:hover {
    background: #dc2626;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: 0.75rem;
}

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

.form-label {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #1f2937;
    font-size: 0.85rem;
}

.form-input:focus {
    outline: none;
    border-color: #6366f1;
}

.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #1f2937;
    font-size: 0.85rem;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: #6366f1;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: monospace;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.modal-header h2,
.modal-header h3 {
    margin: 0;
    color: #111827;
}

/* ============================================================
   STATUS BAR
   ============================================================ */
.status-bar {
    padding: 0.5rem 1rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    font-size: 0.75rem;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
}

.status-saved {
    color: #10b981;
}

.status-unsaved {
    color: #f59e0b;
}

/* ============================================================
   CREDITS
   ============================================================ */
.credits {
    position: fixed;
    bottom: 0.5rem;
    left: 0.5rem;
    color: #9ca3af;
    font-size: 0.65rem;
    z-index: 10;
}

.credits a {
    color: #9ca3af;
    text-decoration: none;
}

.credits a:hover {
    color: #6366f1;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden-input {
    display: none;
}

.text-error {
    color: #ef4444;
}

.text-success {
    color: #10b981;
}

.text-warning {
    color: #f59e0b;
}

.text-muted {
    color: #6b7280;
}

.required-star {
    color: #ef4444;
}

.input-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.status-indicator {
    margin-left: 0.5rem;
    font-size: 0.7rem;
}

/* ============================================================
   ERROR BOUNDARY
   ============================================================ */
.error-boundary {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    min-height: 300px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    margin: 1rem;
}

.error-boundary-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-boundary-title {
    color: #991b1b;
    font-size: 1.25rem;
    margin: 0 0 0.5rem 0;
}

.error-boundary-message {
    color: #b91c1c;
    font-size: 0.95rem;
    margin: 0 0 1.5rem 0;
    max-width: 400px;
}

.error-boundary-details {
    background: #ffffff;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    max-width: 100%;
    width: 500px;
    text-align: left;
}

.error-boundary-details summary {
    cursor: pointer;
    color: #991b1b;
    font-weight: 500;
    font-size: 0.85rem;
}

.error-boundary-details pre {
    font-size: 0.75rem;
    color: #6b7280;
    overflow-x: auto;
    margin: 0.5rem 0 0 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.error-boundary-retry {
    margin-top: 0.5rem;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f3f4f6;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}
