/* ============================================
   GLOBAL STYLES - Professional Auth Website
   Version: 1.0.6
   ============================================ */

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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --border-color: #dee2e6;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --accent-color: #495057;
    --accent-hover: #343a40;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --transition: all 0.2s ease;
    --sidebar-width: 260px;
    --header-height: 60px;
    --footer-height: 40px;
    --titlebar-height: 50px;
    --connection-banner-height: 33px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

/* ============================================
   TITLE BAR - MOVED TO TOP
   ============================================ */

.titlebar-header {
    position: fixed;
    /* margin-bottom: 25px; */
    top: 0;
    left: 0;
    right: 0;
    height: var(--titlebar-height);
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1002;
}

.titlebar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.titlebar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.titlebar-title {
    font-size: 18px;
    font-weight: 600;
}

/* ============================================
   CONNECTION STATUS BANNER
   ============================================ */

.connection-banner {
    position: fixed;
    top: var(--titlebar-height);
    left: 0;
    right: 0;
    height: 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    z-index: 1000;
    transition: var(--transition);
    color: var(--text-secondary);
}

.connection-banner.idle {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
    color: var(--text-secondary);
}

.connection-banner.connected {
    background: #d4edda;
    border-bottom-color: #c3e6cb;
    color: #155724;
}

.connection-banner.disconnected {
    background: #f8d7da;
    border-bottom-color: #f5c6cb;
    color: #721c24;
}

.connection-banner.warning {
    background: #fff3cd;
    border-bottom-color: #ffeaa7;
    color: #856404;
}

.banner-extend-btn {
    padding: 4px 12px;
    border: none;
    background: var(--warning-color);
    color: #000;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-left: 8px;
}

.banner-extend-btn:hover {
    background: #e0a800;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pulse 2s infinite;
}

.connection-banner.connected .status-dot {
    background: var(--success-color);
}

.connection-banner.disconnected .status-dot {
    background: var(--danger-color);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.login-container {
    width: 100%;
    max-width: 480px;
    margin-top: 32px;
}

.login-card {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.language-selector {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 4px;
}

.login-card .language-selector {
    position: absolute;
    top: 20px;
    right: 20px;
}

.lang-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.lang-btn.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 8px;
}

.tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.tab.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */

.dashboard-layout {
    position: fixed;
    top: calc(var(--titlebar-height) + var(--connection-banner-height));
    left: 0;
    right: 0;
    bottom: var(--footer-height);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.connection-banner.hidden {
    display: none;
}

.connection-banner.hidden ~ .dashboard-layout {
    top: var(--titlebar-height);
}


.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: calc(var(--titlebar-height) + var(--connection-banner-height));
    bottom: var(--footer-height);
    left: 0;
    transform: translateX(0);
    transition: transform 0.3s ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-menu {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.menu-item.active {
    background: var(--bg-secondary);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
    font-weight: 500;
}

.menu-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    width: 100%;
}

.sidebar.collapsed~.main-content {
    margin-left: 0;
}

/* Sidebar Backdrop */
.sidebar-backdrop {
    position: fixed;
    top: calc(var(--titlebar-height) + var(--connection-banner-height));
    left: 0;
    right: 0;
    bottom: var(--footer-height);
    background: rgba(0, 0, 0, 0.3);
    z-index: 150;
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

.sidebar-backdrop.hidden {
    opacity: 0;
    pointer-events: none;
}

.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    z-index: 90;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--bg-secondary);
}

.header-title {
    font-size: 18px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.content-area {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    overflow: auto;
    min-height: 0;
}

.content-area:has(.table-container) {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 0 24px;
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1001;
}

.footer-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.footer-right {
    margin-left: auto;
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea,
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-control:disabled {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-control.modified {
    border-color: var(--warning-color);
    background: #fff9e6;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 12px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.form-check label {
    margin: 0;
    cursor: pointer;
    user-select: none;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover:not(:disabled) {
    background: #138496;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   CARDS & SECTIONS
   ============================================ */

.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.info-box {
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
    border-left: 3px solid;
}

.info-box.info-success {
    background: #d4edda;
    border-left-color: var(--success-color);
    color: #155724;
}

.info-box.info-error {
    background: #f8d7da;
    border-left-color: var(--danger-color);
    color: #721c24;
}

.info-box.info-warning {
    background: #fff3cd;
    border-left-color: var(--warning-color);
    color: #856404;
}

.info-box.info-info {
    background: #d1ecf1;
    border-left-color: var(--info-color);
    color: #0c5460;
}

/* ============================================
   TABLE
   ============================================ */

.table-container {
    overflow-x: auto;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
}

thead {
    background: var(--bg-secondary);
}

thead th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
}

tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--bg-secondary);
}

#usersTable thead th:first-child,
#usersTable tbody td:first-child {
    display: none;
}

#logsTableBody {
    /* Marker for parent selector */
}

body:has(#logsTableBody) table thead th:first-child,
body:has(#logsTableBody) table tbody td:first-child {
    display: none;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-admin {
    background: var(--warning-color);
    color: #000;
}

.badge-superadmin {
    background: var(--danger-color);
    color: white;
}

/* ============================================
   MODAL
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 32px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    min-width: 320px;
    max-width: 480px;
    display: none;
    animation: slideIn 0.3s ease;
    z-index: 2000;
}

.toast.show {
    display: block;
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--danger-color);
}

.toast-info {
    border-left: 4px solid var(--info-color);
}

.toast-warning {
    border-left: 4px solid var(--warning-color);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   TERMS LIST ITEMS - WITH SEPARATOR
   ============================================ */

.term-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 0;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
}

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

.term-item:hover {
    background: var(--bg-secondary);
}

.term-item.active {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.term-item-thumbnail {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 20px;
}

.term-item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.term-item-thumbnail.loading {
    background: var(--bg-tertiary);
}

/* Content area */
.term-item-content {
    flex: 1;
    min-width: 0; /* Prevents overflow */
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Title (main text) */
.term-item-title {
    font-weight: 500;
    font-size: 14px;
    line-height: 1.3;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Meta info row */
.term-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.term-item-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.term-item-meta-separator {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.5;
}

/* Language badge in meta */
.term-item-lang-badge {
    display: inline-block;
    padding: 2px 6px;
    background: var(--accent-color);
    color: white;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
}

/* Footer (dates) */
.term-item-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    color: var(--text-muted);
}

/* OLD image badge - remove if using new thumbnail layout */
.term-item-image-badge {
    display: none; /* Hidden when using left thumbnail */
}

/* Image Hover Modal (keep existing styles) */
.image-hover-modal {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-hover-modal.show {
    opacity: 1;
}

.image-hover-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 8px;
    max-width: 400px;
    max-height: 400px;
}

.image-hover-content img {
    width: 100%;
    height: auto;
    max-height: 380px;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

.image-hover-loading {
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 4px;
}

.image-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 0.6s linear infinite;
}

.terms-container {
    display: flex;
    gap: 24px;
    height: calc(100vh - 132px - var(--footer-height));
}

.terms-sidebar {
    width: 300px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.terms-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

.search-box:focus {
    outline: none;
    border-color: var(--accent-color);
}

.language-filter-container {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.language-filter-container select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    background: var(--bg-primary);
    cursor: pointer;
}

.language-filter-container select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.terms-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.term-item {
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.term-item:hover {
    background: var(--bg-secondary);
}

.term-item.active {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.term-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.term-item-title {
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 14px;
}

.term-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: var(--text-muted);
}

.terms-content {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.terms-content-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.terms-tabs {
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 24px;
}

.terms-tab {
    padding: 12px 0;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.terms-tab:hover {
    color: var(--text-primary);
}

.terms-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-color);
}

.terms-tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.terms-tab-pane {
    display: none;
}

.terms-tab-pane.active {
    display: block;
}

.translation-item {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: flex-start;
}

.translation-item .form-group {
    flex: 1;
    margin-bottom: 0;
}

.language-badge {
    display: inline-block;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-left: 8px;
}

.badge-new {
    background: var(--success-color);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 8px;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.pagination-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Legacy Language Tabs */
.legacy-language-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.legacy-lang-tab {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.legacy-lang-tab:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.legacy-lang-tab.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

@media (max-width: 1024px) {
    .terms-container {
        flex-direction: column;
        height: auto;
    }

    .terms-sidebar {
        width: 100%;
        height: 400px;
    }
}

/* ============================================
   IMAGE MANAGEMENT STYLES
   ============================================ */

/* Image Upload Section */
.image-upload-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.image-upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.image-preview-container {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.image-preview {
    position: relative;
    width: 200px;
    height: 200px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-empty {
    color: var(--text-muted);
    font-size: 48px;
}

.image-preview-actions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.image-preview:hover .image-preview-actions {
    opacity: 1;
}

.image-action-btn {
    padding: 6px;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.image-action-btn:hover {
    background: white;
    transform: scale(1.1);
}

.image-action-btn svg {
    display: block;
    width: 16px;
    height: 16px;
}

/* Image Badge in Term List */
.term-item {
    position: relative;
}

.term-item-image-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 2px solid var(--bg-primary);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
}

.term-item-image-badge img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.term-item-image-badge:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
    z-index: 10;
}

/* Image Hover Modal */
.image-hover-modal {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-hover-modal.show {
    opacity: 1;
}

.image-hover-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 8px;
    max-width: 400px;
    max-height: 400px;
}

.image-hover-content img {
    width: 100%;
    height: auto;
    max-height: 380px;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

.image-hover-loading {
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 4px;
}

/* Loading Spinner for Images */
.image-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 0.6s linear infinite;
}

/* File Input Hidden */
.file-input-hidden {
    display: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .dashboard-layout {
        padding-top: calc(var(--titlebar-height) + 32px);
    }

    .dashboard-layout.no-banner {
        padding-top: var(--titlebar-height);
    }

    .sidebar {
        top: var(--titlebar-height);
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .header {
        top: var(--titlebar-height);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .connection-banner {
        position: fixed;
        top: var(--titlebar-height);
    }

    .login-card {
        padding: 24px;
    }

    .footer-left,
    .footer-center {
        font-size: 11px;
    }

    .footer-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    /* Titlebar responsive adjustments */
    .titlebar-header {
        padding: 0 12px;
    }

    .titlebar-left {
        gap: 8px;
    }

    .titlebar-right {
        gap: 8px;
    }

    .titlebar-title {
        font-size: 16px;
    }

    .titlebar-logo img {
        width: 24px !important;
        height: 24px !important;
    }

    .btn-secondary span {
        display: none;
    }

    .btn-secondary {
        padding: 8px 10px;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gap-1 {
    gap: 8px;
}

.gap-2 {
    gap: 16px;
}

.gap-3 {
    gap: 24px;
}

/* ============================================
   LOGS PAGE
   ============================================ */

.logs-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.card:has(.logs-filters) {
    padding: 12px;
    margin-bottom: 12px;
}

.card:has(.table-container) {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.card:has(.table-container) .table-container {
    flex: 1;
    border: none;
    border-radius: 0 0 8px 8px;
}

.log-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.log-row {
    cursor: pointer;
    transition: var(--transition);
}

.log-row:hover {
    background: var(--bg-secondary);
}

.log-type-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.log-type-info {
    background: #d1ecf1;
    color: #0c5460;
}

.log-type-warning {
    background: #fff3cd;
    color: #856404;
}

.log-type-error {
    background: #f8d7da;
    color: #721c24;
}

.log-type-debug {
    background: #e2e3e5;
    color: #383d41;
}

.log-message {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.pagination-buttons {
    display: flex;
    gap: 8px;
}

.filter-actions {
    display: flex;
    height: 40px;
    gap: 8px;
    grid-row: 1;
    grid-column: 5 / -1;
    margin-top: 27px;
}

.refresh-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
}

/* Modal Header - FIXED */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

/* Detail Tab Styles */
.detail-tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.detail-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.detail-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.detail-tab-pane {
    display: none;
}

.detail-tab-pane.active {
    display: block;
}

.history-count-badge {
    display: inline-block;
    background: var(--accent-color);
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

/* History Timeline Styles */
.history-entry {
    position: relative;
    padding: 16px;
    padding-left: 48px;
    border-left: 2px solid var(--border-color);
    margin-bottom: 16px;
}

.history-entry:last-child {
    border-left-color: transparent;
}

.history-entry::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 20px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 2px solid var(--accent-color);
}

.history-entry.encrypted::before {
    border-color: #ffc107;
    background: #fff9e6;
}

.history-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-entry-id {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.history-entry-timestamp {
    font-size: 12px;
    color: var(--text-muted);
}

.history-entry-content {
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 12px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    max-height: 300px;
    overflow-y: auto;
    position: relative;
    white-space: pre-wrap;
    word-break: break-word;
}

.history-entry-encrypted-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 193, 7, 0.1);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.history-encryption-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.history-encryption-badge.encrypted {
    background: #fff3cd;
    color: #856404;
}

.history-encryption-badge.unencrypted {
    background: #d4edda;
    color: #155724;
}

.btn-decrypt {
    padding: 6px 12px;
    border: 1px solid var(--warning-color);
    background: var(--warning-color);
    color: #000;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-decrypt:hover {
    background: #e0a800;
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    color: var(--text-primary);
}