/* OBS Overlay - Central Stylesheet */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
}

input, textarea, select {
    pointer-events: auto !important;
    -webkit-user-select: text !important;
    user-select: text !important;
}

/* Header Styles */
.header {
    background: white;
    border-bottom: 1px solid #ddd;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header h1 {
    color: #333;
    font-size: 1.5em;
}

.header a {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 15px;
    border-radius: 4px;
    transition: background 0.2s;
}

.header a:hover {
    background: #f0f0f0;
}

/* Navigation Styles */
.nav {
    background: white;
    border-bottom: 1px solid #ddd;
    padding: 0 30px;
    display: flex;
    gap: 0;
}

.nav-item {
    padding: 15px 25px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    color: #666;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    display: block;
}

.nav-item:hover {
    color: #007bff;
    background: #f8f9fa;
}

.nav-item.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

/* Content and Layout */
.content {
    /*max-width: 1400px;*/
    margin: 0 auto;
    padding: 30px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

iframe {
    border: none;
    outline: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 30px;
}

/* Typography */
h1 {
    color: #333;
    margin-bottom: 30px;
}

h2 {
    color: #555;
    margin-bottom: 20px;
    font-size: 1.3em;
}

/* Sections */
.section {
    margin-bottom: 40px;
    padding: 20px;
    background: #fafafa;
    border-radius: 6px;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    color: #666;
    font-weight: 500;
}

input, select, button {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

button {
    background: #007bff;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

button:hover {
    background: #0056b3;
}

button.secondary {
    background: #6c757d;
    color: white;
}

button.secondary:hover {
    background: #545b62;
}

button.danger {
    background: #dc3545;
    color: white;
}

button.danger:hover {
    background: #c82333;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 20px;
    flex-wrap: nowrap;
    border-bottom: 2px solid #ddd;
    padding-bottom: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f5f5f5;
}

.tabs::-webkit-scrollbar {
    height: 8px;
}

.tabs::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.tabs::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.tabs::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.tab {
    padding: 8px 12px;
    background: #e9ecef;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 13px;
    border-right: 1px solid #ddd;
    width: 185px;
}

.tab:hover {
    background: #dee2e6;
}

.tab.active {
    background: #007bff;
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Database Styles */
.database-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
}

.database-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
}

.database-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.database-header h3 {
    color: #333;
}

.database-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.database-actions button {
    width: auto;
    padding: 8px 15px;
    font-size: 12px;
}

.databases-list {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 10px;
}

.badge.sub-db {
    background: #17a2b8;
    color: white;
}

/* Fields List */
.fields-list {
    margin: 10px 0;
}

.field-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.field-item input {
    flex: 1;
}

.field-item button {
    width: auto;
    padding: 10px 15px;
    margin: 0;
}

/* Search */
.search-container {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.search-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.column-filter {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 150px;
}

/* Forms */
.add-data-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.add-data-form input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 0;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    width: 110px;
}

tr:hover {
    background: #f8f9fa;
}

.checkbox-cell {
    text-align: center;
    width: 60px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    pointer-events: auto;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
}

.modal input,
.modal textarea,
.modal select {
    pointer-events: auto !important;
    -webkit-user-select: text !important;
    user-select: text !important;
}

/* Edit Field Styles */
.edit-field-list {
    margin: 15px 0;
}

.edit-field-item {
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-field-item:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.edit-field-item.selected {
    background: #e7f3ff;
    border-color: #007bff;
}

.edit-field-item label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.edit-field-item input[type="text"] {
    margin-top: 5px;
    display: none;
}

.edit-field-item.selected input[type="text"] {
    display: block;
}

/* Sub-Database Form */
.sub-db-form {
    margin-top: 15px;
}

.sub-db-form .form-group {
    margin-bottom: 15px;
}

/* Success Message */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: none;
}

.success-message.show {
    display: block;
}

/* Empty State */
.empty-state {
    padding: 40px;
    text-align: center;
    color: #999;
}

/* Login Styles */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 30px;
}

.login-error {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    display: none;
}

.login-error.show {
    display: block;
}

