/* ============================================
   WIKI EDITOR STYLESHEET
   Based on Data Form Styles
   ============================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #000435;
    background: #F2EEDF;
    margin: 0;
    padding: 20px;
}

.wiki-editor-page {
    width: 100%;
}

.container {
    max-width: 1100px; /* Widened to accommodate side-by-side management */
    margin: 0 auto;
    background: #AEE0ED;
    border: 2px solid #33A7B5;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(252, 142, 214, 0.15), 0 8px 24px rgba(178, 225, 2, 0.1);
    position: relative;
    border: 3px solid transparent;
    background-clip: padding-box;
}

.container::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(135deg, #FC8ED6, #B2E102, #33A7B5, #EF9034);
    border-radius: 12px;
    z-index: -1;
}

/* Headers */
.admin-header {
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%);
    color: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
    text-align: center;
    border: 3px solid #FE8088;
}

.admin-header h1 {
    margin: 0 0 10px 0;
    font-size: 28px;
    color: #FFFFFF;
    font-weight: 700;
}

.admin-header p {
    margin: 0;
    opacity: 0.95;
    font-size: 16px;
    color: #FFFFFF;
}

.admin-warning {
    background: #FFF5CB;
    border: 2px solid #EF9034;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 25px;
    color: #000435;
    font-weight: 600;
}

/* ============================================
   VERTICAL LAYOUT FOR MANAGEMENT
   ============================================ */
.wiki-management-grid {
    display: block; /* Remove flex */
    margin-bottom: 30px;
}

.index-selection-pane {
    width: 100%;
    margin-bottom: 20px;
}

.facilities-list-pane {
    width: 100%;
}

/* ============================================
   PROJECT MANAGEMENT / LOADING SYSTEM
   ============================================ */
.project-management {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
}

.project-management h2 {
    text-align: left;
    color: #000435;
    font-size: 18px;
    font-weight: 700;
    margin: 5px 0 12px 0;
}

.project-management label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #000435;
    font-size: 14px;
}

.input-form,
.project-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.input-form:focus,
.project-search-input:focus {
    border-color: #33A7B5;
    box-shadow: 0 0 0 3px rgba(51, 167, 181, 0.1);
    outline: none;
}

.saved-projects-list,
.entries-list,
.index-entries-list {
    max-height: 400px;
    overflow-y: auto;
    border: 2px solid #33A7B5;
    border-radius: 10px;
    padding: 12px;
    background: #FFFFFF;
    box-shadow: 0 2px 6px rgba(51, 167, 181, 0.2);
    margin-top: 5px;
}

.saved-projects-list p.loading,
.entries-list p.loading,
.index-entries-list p.loading {
    color: #6b7280;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.entry-status-badge {
    display: inline-block;
    margin-right: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    vertical-align: middle;
}

.entry-status-approved {
    background: #ECF385;
    color: #000435;
    border: 1px solid #B2E102;
}

.entry-status-published {
    background: #B6E3D4;
    color: #000435;
    border: 1px solid #33A7B5;
}

/* ============================================
   TABS
   ============================================ */
.category-tabs {
    display: flex;
    gap: 5px;
    background: #FFF5CB;
    padding: 5px;
    border-radius: 8px;
    justify-content: flex-start;
    border: 2px solid #B2E102;
    margin-bottom: 15px;
}

.category-tab {
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid transparent;
    background: transparent;
    color: #000435;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.category-tab:hover {
    background: #fff;
}

.category-tab.active {
    background: #000080;
    color: #FFFFFF;
    border: 2px solid #FE8088;
}

.category-content {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
}

.category-content.view-hidden {
    display: none !important;
}

.content-header h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 700;
    color: #000435;
}

/* ============================================
   INDEX ROW STYLING
   ============================================ */
.index-entry-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.index-entry-row:hover {
    background: #f0f9fa;
}

.index-entry-name {
    font-weight: 600;
    color: #000435;
    font-size: 14px;
}

.index-entry-actions {
    display: flex;
    gap: 5px;
}

.index-entry-actions button, .index-entry-actions a {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: none;
    border: 1px solid #33A7B5;
    background: #fff;
    color: #33A7B5;
    cursor: pointer;
}

.index-entry-actions button:hover {
    background: #33A7B5;
    color: #fff;
}

.index-empty-flag {
    color: #FE8088;
    font-weight: 800;
    font-size: 10px;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
fieldset {
    background: #FFF5CB;
    border: 2px solid #B2E102;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(178, 225, 2, 0.15);
}

legend {
    font-size: 1.2rem;
    font-weight: 600;
    color: #33A7B5;
    padding: 0 10px;
    background: #FFFFFF;
    border: 2px solid #B2E102;
    border-radius: 5px;
}

label {
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 5px;
    display: block;
    color: #000435;
}

input[type="text"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #000435;
    border-radius: 5px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 1rem;
    background-color: #FFFFFF;
    transition: border-color 0.2s ease;
}

.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.field-group {
    flex: 1;
    min-width: 150px;
}

/* Buttons */
.btn {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid #FE8088;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #B6E3D4;
    color: #000435;
    border-color: #33A7B5;
}

.btn-danger {
    background: #FE8088;
    border-color: #000435;
}

/* Mode Toggle */
.editor-mode-toggle {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.mode-btn {
    background-color: #FFFFFF;
    color: #000435;
    border: 2px solid #33A7B5;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
}

.mode-btn.active {
    background-color: #33A7B5;
    color: #FFFFFF;
}

.hidden-section {
    display: none !important;
}

/* List Previews */
.list-preview {
    margin-top: 15px;
    background: #AEE0ED;
    border: 2px dashed #33A7B5;
    border-radius: 5px;
    padding: 10px;
    display: none; /* Hidden by default, JS toggles display:block */
}

.list-preview-item {
    font-size: 0.9rem;
    padding: 8px;
    border-bottom: 1px solid #B6E3D4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #FFFFFF;
    margin-bottom: 5px;
    border-radius: 3px;
}

.list-preview-item:last-child {
    border-bottom: none;
}

.list-preview-item button {
    background: #FE8088;
    color: #FFFFFF;
    border: 2px solid #FE8088;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
}

.staff-preview-item {
    flex-direction: column;
    align-items: flex-start;
}

.staff-actions {
    margin-top: 5px;
    display: flex;
    gap: 5px;
}

/* Output */
#outputCode {
    width: 100%;
    height: 400px;
    background-color: #ECF385;
    border: 2px solid #33A7B5;
    border-radius: 5px;
    font-family: monospace;
    padding: 12px;
}

.output-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Modal */
.submit-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 4, 53, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

/* ============================================
   ORGANIZATION / FACILITY MODE TOGGLE
   ============================================ */

/* Hide org-only fields by default (facility mode) */
.organization-only-field {
    display: none;
}

/* In org mode: show org fields, hide facility-only fields */
.organization-mode .organization-only-field {
    display: block;
}
.organization-mode .facility-only-field {
    display: none;
}

.submit-modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
}