/* MotionView - Clean Minimalist Style */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --document-list-font-size: 15px;
    --document-content-font-size: 18px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

/* Layout */
.container {
    display: flex;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
}

/* Left Panel - Document List */
.left-panel {
    display: flex;
    flex-direction: column;
    width: 30%;
    flex: 0 0 30%;
    background: #ffffff;
    overflow: hidden;
    height: 100vh;
    min-height: 0;
    padding: 20px;
}

.app-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.left-panel h1 {
    font-size: 1.5rem;
    margin-bottom: 0;
    color: #2c3e50;
}

.refresh-button {
    white-space: nowrap;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.upload-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.upload-form input[type="file"] {
    max-width: 170px;
    font-size: 0.78rem;
}

.reset-filters-button {
    margin-left: 8px;
    white-space: nowrap;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.login-panel {
    width: min(360px, calc(100vw - 32px));
    padding: 24px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.login-panel h1 {
    margin-bottom: 18px;
    color: #2c3e50;
    font-size: 1.5rem;
}

.login-panel label {
    display: block;
    margin-bottom: 6px;
}

.login-panel .btn {
    margin-top: 12px;
    width: 100%;
}

.login-error {
    margin-top: 10px;
    color: #c62828;
    font-size: 0.9rem;
}

.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.error-panel {
    width: min(440px, calc(100vw - 32px));
    padding: 26px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
}

.error-code {
    margin-bottom: 6px;
    color: #3498db;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.error-panel h1 {
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 1.4rem;
}

.error-panel p {
    color: #666;
}

.error-action {
    display: inline-block;
    margin-top: 18px;
    text-decoration: none;
}

/* Filter Section */
.filter-section {
    flex-shrink: 0;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-group {
    flex: 1;
    min-width: 105px;
    margin-bottom: 6px;
}

.filter-group label {
    display: block;
    margin-bottom: 3px;
    font-weight: bold;
    font-size: 0.82rem;
    color: #333;
}

.font-size-controls {
    display: grid;
    grid-template-columns: minmax(120px, auto) minmax(120px, 1fr) auto auto;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.font-size-controls label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #555;
}

.font-size-controls input[type="range"] {
    width: 100%;
}

.font-size-value {
    min-width: 34px;
    color: #666;
    font-size: 0.75rem;
}

.btn-small {
    padding: 4px 8px;
    font-size: 0.75rem;
}

/* Unified form styling */
.form-select,
.form-input,
.notes-textarea,
.modal .form-group input,
.modal .form-group textarea,
#inlineParty,
#inlineType {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #fff;
    color: #333;
    box-sizing: border-box;
    font-family: inherit;
}

/* Native select reset */
.form-select {
    font-size: 0.95rem;

    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    transition:
        border-color 0.3s,
        box-shadow 0.3s;
}

.form-input {
    font-size: 0.9rem;
}

.form-select:focus,
.form-input:focus,
.notes-textarea:focus,
.modal .form-group input:focus,
.modal .form-group textarea:focus,
#inlineParty:focus,
#inlineType:focus {
    border-color: #007BFF;
    outline: none;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

#statusFilter {
    min-width: 120px;
}

/* Document List */
.document-list {
    flex: 1;
    list-style: none;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.document-list-empty {
    padding: 14px;
    color: #777;
    background: #f8f9fa;
    border: 1px dashed #d5d5d5;
    border-radius: 6px;
    font-size: 0.9rem;
}

.runtime-status {
    margin-top: 10px;
    font-size: 0.78rem;
    line-height: 1.5;
    word-break: break-word;
}

.inline-reset-button {
    margin-left: 8px;
}

.document-row {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 4px;
}

.document-row:hover {
    background-color: #f8f9fa;
}

.document-row.active {
    background-color: #e3f2fd;
    border-left: 3px solid #3498db;
}

.document-row.active.type-motie {
    background-color: #e3f2fd;
    border-left-color: #3498db;
}

.document-row.active.type-amendement {
    background-color: #fff9e6;
    border-left-color: #f57c00;
}

.document-row a {
    text-decoration: none;
    color: #2c3e50;
    display: block;
}

.document-row .filename {
    font-weight: 500;
    margin-bottom: 5px;
    font-size: var(--document-list-font-size);
}

.document-row .meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: calc(var(--document-list-font-size) * 0.8);
}

.document-row .tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: calc(var(--document-list-font-size) * 0.74);
    font-weight: 500;
}

.document-row .tag.type-motie {
    background-color: #e3f2fd;
    color: #1976d2;
}

.document-row .tag.type-amendement {
    background-color: #fff3e0;
    color: #f57c00;
}

.document-row .tag.party {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.document-row .tag.custom {
    background-color: #e8f5e9;
    color: #388e3c;
}

/* Status tags with colors */
.tag.status-voor,
.document-row .tag.status-voor {
    background-color: #c8e6c9;
    padding: 1px 4px;
    border-radius: 3px;
    color: #2e7d32;
}

.tag.status-tegen,
.document-row .tag.status-tegen {
    background-color: #ffcdd2;
    padding: 1px 4px;
    border-radius: 3px;
    color: #c62828;
}

.tag.status-navraag,
.document-row .tag.status-navraag {
    background-color: #e1f5fe;
    padding: 1px 4px;
    border-radius: 3px;
    color: #01579b;
}

.tag.status-overleg,
.document-row .tag.status-overleg {
    background-color: #ffe0b2;
    padding: 1px 4px;
    border-radius: 3px;
    color: #e65100;
}

.tag.status-todo,
.document-row .tag.status-todo {
    background-color: #ffffff;
    padding: 1px 4px;
    border-radius: 3px;
    color: #666;
    border: 1px solid #e0e0e0;
}

.tag.status-upload,
.document-row .tag.status-upload {
    background-color: #ede7f6;
    padding: 1px 4px;
    border-radius: 3px;
    color: #512da8;
}

/* Responsible person tag */
.tag.responsible,
.document-row .tag.responsible {
    background-color: #f0f0f0;
    color: #444;
    border: 1px solid #ccc;
}

.document-row .tag.number {
    background-color: #e8eef5;
    color: #2c3e50;
    border: 1px solid #cfd9e6;
}

.panel-resizer {
    flex: 0 0 8px;
    width: 8px;
    height: 100vh;
    background: #f1f3f5;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    cursor: col-resize;
    position: relative;
    z-index: 5;
}

.panel-resizer::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 42px;
    background: #c8d0d8;
    border-radius: 2px;
    transform: translate(-50%, -50%);
}

.panel-resizer:hover,
.panel-resizer:focus {
    background: #e7f1fb;
    outline: none;
}

.panel-resizer:hover::before,
.panel-resizer:focus::before,
.is-resizing-panels .panel-resizer::before {
    background: #3498db;
}

.is-resizing-panels {
    cursor: col-resize;
    user-select: none;
}

/* Right Panel - Document Viewer */
.right-panel {
    width: 70%;
    flex: 1 1 70%;
    background: #ffffff;
    padding: 25px;
    overflow-y: auto;
    height: 100vh;
    min-height: 0;
}

.right-panel h2 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #2c3e50;
}

.empty-state {
    color: #999;
    text-align: center;
    padding: 40px;
    font-size: 1.1rem;
}

/* Document Metadata */
.metadata {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.metadata .meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
}

.metadata .meta-item strong {
    color: #666;
}

.metadata .meta-item span {
    color: #333;
}

.document-font-size-controls {
    grid-template-columns: auto minmax(120px, 180px) auto auto;
    margin-bottom: 0;
    margin-left: auto;
    max-width: 440px;
}

/* Document Content */
.document-content {
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 25px;
    white-space: pre-wrap;
    line-height: 1.8;
    font-size: var(--document-content-font-size);
    overflow-y: auto;
    resize: vertical;
    min-height: 180px;
    max-height: 75vh;
}

.document-content.type-motie {
    background: #e3f2fd;
}

.document-content.type-amendement {
    background: #fff9e6;
}

.document-content p {
    margin-bottom: 1em;
}

/* Notes Section */
.notes-section {
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
}

.notes-section h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #2c3e50;
}

.notes-textarea {
    min-height: 100px;
    resize: vertical;
    margin-bottom: 10px;
}

.tag-editor {
    margin-bottom: 12px;
}

.metadata-edit .form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-size: 1rem;
    font-weight: normal;
}

.tag-editor label {
    color: #333;
    font-size: 1rem;
    font-weight: normal;
    white-space: nowrap;
}

.tag-editor .tags-input {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.tag-editor .tag-chip {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.tag-editor .tag-chip .remove-tag {
    cursor: pointer;
    background: none;
    border: none;
    color: #1976d2;
    font-size: 0.8rem;
    padding: 0;
}

.tag-editor .tag-chip .remove-tag:hover {
    color: #0d47a1;
}

.tag-add-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag-add-row .form-input {
    flex: 1;
}

.tag-add-row .document-number-input {
    flex: 0 0 120px;
}

.metadata-edit {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 8px 12px;
    margin-bottom: 12px;
}

.combobox {
    position: relative;
}

.combobox-options {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 190px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.combobox-options.is-visible {
    display: block;
}

.combobox-option {
    display: block;
    width: 100%;
    padding: 7px 9px;
    border: 0;
    background: #fff;
    color: #333;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.combobox-option:hover,
.combobox-option:focus {
    background: #e7f1fb;
    outline: none;
}

.btn {
    padding: 7px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #ecf0f1;
    color: #666;
}

.btn-secondary:hover {
    background-color: #bdc3c7;
}


.btn-danger {
    background-color: #c0392b;
    color: white;
}

.btn-danger:hover {
    background-color: #922b21;
}

.document-delete-form {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

/* Modal Styles */
.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: 1000;
}

.modal {
    background: white;
    padding: 25px;
    border-radius: 8px;
    min-width: 400px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.modal .form-group {
    margin-bottom: 15px;
}

.modal .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #666;
}

.modal .tags-input {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.modal .tag-chip {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.modal .tag-chip .remove-tag {
    cursor: pointer;
    background: none;
    border: none;
    color: #1976d2;
    font-size: 0.8rem;
    padding: 0;
}

.modal .tag-chip .remove-tag:hover {
    color: #0d47a1;
}

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

/* Status messages */
.status-message {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1100;
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 0.9rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.status-message.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-message.error {
    background: #ffebee;
    color: #c62828;
}

/* Responsive */
@media (max-width: 900px) {
    .container {
        flex-direction: column;
        height: 100vh;
    }

    .left-panel {
        width: 100%;
        flex: none;
        height: 40vh;
    }

    .panel-resizer {
        display: none;
    }

    .right-panel {
        width: 100%;
        flex: none;
        height: 60vh;
    }

    .font-size-controls {
        grid-template-columns: 1fr auto;
    }

    .font-size-controls label,
    .font-size-controls input[type="range"] {
        grid-column: span 2;
    }

    .metadata-edit {
        grid-template-columns: 1fr;
    }
}
