/* LAQI Support Dashboard Styles */
/* Theme: Laqi.co design (Navy #113D5B, Yellow #F0C417, Barlow font) */

:root {
    /* Primary colors */
    --laqi-navy: #113D5B;
    --laqi-navy-dark: #0A2A3F;
    --laqi-navy-light: #1A5273;
    --laqi-yellow: #F0C417;
    --laqi-yellow-dark: #D4A912;
    --laqi-yellow-light: #F5D647;

    /* Status colors */
    --status-success: #27ae60;
    --status-warning: #f39c12;
    --status-error: #e74c3c;
    --status-info: #3498db;
    --status-disabled: #95a5a6;

    /* Neutral colors */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8F9FA;
    --bg-tertiary: #E9ECEF;
    --text-primary: #2C3E50;
    --text-secondary: #7F8C8D;
    --border-color: #DEE2E6;

    /* Font */
    --font-family: 'Barlow', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-weight: 500;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    overflow-x: hidden;
}

/* ============================================================================
   Login Screen
   ============================================================================ */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--laqi-navy) 0%, var(--laqi-navy-light) 100%);
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    max-width: 450px;
    width: 100%;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--laqi-navy);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-form input {
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-family);
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--laqi-navy);
}

.login-error {
    padding: 12px;
    background: rgba(231, 76, 60, 0.1);
    color: var(--status-error);
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
}

/* ============================================================================
   Dashboard Layout
   ============================================================================ */

.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    background: var(--laqi-navy);
    color: white;
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
}

.dashboard-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.tech-name {
    font-weight: 600;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.dashboard-content {
    display: flex;
    flex: 1;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    gap: 20px;
    padding: 20px;
}

/* ============================================================================
   Sidebar
   ============================================================================ */

.sidebar {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.panel h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--laqi-navy);
    margin-bottom: 15px;
}

/* Clients List */
.clients-list {
    max-height: 400px;
    overflow-y: auto;
}

.client-item {
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 4px solid var(--laqi-navy);
    cursor: pointer;
    transition: all 0.3s;
}

.client-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
}

.client-item.active {
    background: rgba(17, 61, 91, 0.1);
    border-left-color: var(--laqi-yellow);
}

.client-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.client-session {
    font-weight: 600;
    color: var(--laqi-navy);
    font-size: 0.9rem;
}

.client-progress {
    font-size: 0.85rem;
    color: var(--status-success);
    font-weight: 600;
}

.client-stage {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.client-device {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.client-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.client-actions button {
    flex: 1;
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 4px;
}

/* Quick Commands */
.quick-commands {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ============================================================================
   Main Content
   ============================================================================ */

.main-content {
    flex: 1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    padding: 0 20px;
}

.tab {
    padding: 15px 25px;
    background: none;
    border: none;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
}

.tab:hover {
    color: var(--laqi-navy);
}

.tab.active {
    color: var(--laqi-navy);
    border-bottom-color: var(--laqi-yellow);
}

/* Tab Content */
.tab-content {
    display: none;
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.tab-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--laqi-navy);
}

.tab-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    width: 250px;
}

.search-input:focus {
    outline: none;
    border-color: var(--laqi-navy);
}

.sort-select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    cursor: pointer;
}

/* Reports List */
.reports-list {
    display: grid;
    gap: 15px;
}

.report-card {
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--laqi-navy);
    cursor: pointer;
    transition: all 0.3s;
    overflow: hidden;
    min-width: 0;
}

.report-card:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Ensure report cards fit in container */
.reports-list {
    width: 100%;
    overflow: hidden;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
    min-width: 0;
}

.report-id {
    font-weight: 700;
    color: var(--laqi-navy);
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.report-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.ticket-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--laqi-navy);
    color: white;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.report-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.status-open { background: #e3f2fd; color: #1565c0; }
.status-in-progress { background: #fff3e0; color: #e65100; }
.status-resolved { background: #e8f5e9; color: #2e7d32; }
.status-closed { background: #f5f5f5; color: #757575; }

.report-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.report-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.report-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.report-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.report-value {
    font-weight: 600;
    color: var(--laqi-navy);
    font-size: 0.9rem;
}

.report-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* Activity Log */
.activity-log-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.activity-log {
    flex: 1;
    background: #1e1e1e;
    color: #f0f0f0;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    overflow-y: auto;
    max-height: 600px;
}

.activity-entry {
    margin-bottom: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.activity-timestamp {
    color: #7f8c8d;
    margin-right: 8px;
}

.activity-info { color: #f0f0f0; }
.activity-success { color: #27ae60; }
.activity-error { color: #e74c3c; }
.activity-warning { color: #f39c12; }

/* ============================================================================
   Modal
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--laqi-navy);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--laqi-navy);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.package-info {
    margin-bottom: 25px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.info-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.info-value {
    font-weight: 600;
    color: var(--laqi-navy);
    font-size: 1rem;
    word-break: break-all;
}

.section {
    margin-bottom: 25px;
}

.section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--laqi-navy);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.modal-actions {
    display: flex;
    gap: 15px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn {
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font-family);
    border: none;
    border-radius: 60px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: var(--laqi-navy);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--laqi-navy-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(17, 61, 91, 0.3);
}

.btn-secondary {
    background: var(--laqi-yellow);
    color: var(--laqi-navy);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--laqi-yellow-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(240, 196, 23, 0.3);
}

.btn-danger {
    background: var(--status-error);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn:disabled {
    background: var(--status-disabled);
    color: white;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

/* Clear Activity Log Confirmation State */
.btn.confirming {
    background: var(--laqi-navy);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    align-items: stretch;
    min-width: 200px;
}

.btn.confirming:hover {
    background: var(--laqi-navy);
    transform: none;
    box-shadow: none;
}

.confirm-actions {
    display: flex;
    gap: 8px;
}

.confirm-yes,
.confirm-no {
    flex: 1;
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-yes {
    background: var(--status-error);
    color: white;
}

.confirm-yes:hover {
    background: #c0392b;
    transform: scale(1.05);
}

.confirm-no {
    background: var(--text-secondary);
    color: white;
}

.confirm-no:hover {
    background: var(--laqi-navy-dark);
    transform: scale(1.05);
}

/* ============================================================================
   Empty State
   ============================================================================ */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ============================================================================
   Database Explorer & Log Decoder
   ============================================================================ */

.database-explorer,
.log-decoder {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
}

.collapsible-section {
    margin-bottom: 15px;
}

.collapsible-header {
    background: var(--laqi-navy);
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.collapsible-header:hover {
    background: var(--laqi-navy-light);
}

.collapsible-header.active {
    border-radius: 6px 6px 0 0;
}

.collapsible-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.collapsible-icon {
    transition: transform 0.3s;
}

.collapsible-header.active .collapsible-icon {
    transform: rotate(90deg);
}

.collapsible-content {
    display: none;
    padding: 15px;
    background: white;
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
}

.collapsible-content.active {
    display: block;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--laqi-navy);
}

.data-table tr:hover {
    background: var(--bg-secondary);
}

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 1024px) {
    .dashboard-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .info-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        padding: 15px 20px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .dashboard-content {
        padding: 15px;
    }

    .tab-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tab-actions {
        width: 100%;
        flex-direction: column;
    }

    .search-input {
        width: 100%;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        max-height: 95vh;
    }

    .modal-body {
        padding: 20px;
    }
}

/* ============================================================================
   Database Explorer - Validation and Tree View Styles
   ============================================================================ */

/* Validation Results */
.validation-results {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.validation-success {
    padding: 15px;
    background: rgba(76, 175, 80, 0.1);
    border-left: 4px solid #4caf50;
    border-radius: 4px;
    color: #2e7d32;
    font-weight: 500;
}

.validation-issue {
    padding: 15px;
    border-radius: 4px;
    border-left: 4px solid;
}

.validation-error {
    background: rgba(244, 67, 54, 0.1);
    border-left-color: #f44336;
}

.validation-warning {
    background: rgba(255, 152, 0, 0.1);
    border-left-color: #ff9800;
}

.issue-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.issue-icon {
    font-size: 1.2rem;
}

.issue-category {
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.validation-error .issue-category {
    color: #d32f2f;
}

.validation-warning .issue-category {
    color: #f57c00;
}

.issue-message {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.issue-details {
    margin: 8px 0 0 30px;
    padding: 0;
    list-style: none;
}

.issue-details li {
    padding: 4px 0;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.issue-details li:before {
    content: '→ ';
    color: var(--laqi-yellow);
    font-weight: bold;
    margin-right: 8px;
}

/* Tree View */
.tree-view {
    font-family: var(--font-family);
    padding: 10px;
}

.tree-node {
    display: flex;
    align-items: flex-start;
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.tree-node:hover {
    background: rgba(17, 61, 91, 0.05);
}

.tree-icon {
    font-size: 1.3rem;
    margin-right: 10px;
    flex-shrink: 0;
}

.tree-label {
    font-weight: 600;
    color: var(--laqi-navy);
    margin-right: 10px;
}

.tree-detail {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.tree-children {
    margin-left: 30px;
    border-left: 2px solid #e0e0e0;
    padding-left: 15px;
}

.tree-root {
    background: linear-gradient(135deg, rgba(17, 61, 91, 0.1), rgba(17, 61, 91, 0.05));
    border-left: 4px solid var(--laqi-navy);
}

.tree-room {
    background: rgba(76, 175, 80, 0.05);
    border-left: 4px solid #4caf50;
}

.tree-fixture {
    background: rgba(33, 150, 243, 0.05);
    border-left: 4px solid #2196f3;
}

.tree-device {
    background: rgba(156, 39, 176, 0.05);
    border-left: 4px solid #9c27b0;
}

.tree-orphan {
    background: rgba(255, 152, 0, 0.1);
    border-left: 4px solid #ff9800;
}

.tree-orphan .tree-label {
    color: #f57c00;
}

.tree-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* ============================================================================
   Phase 6: Enhanced Orphaned Element Visualization
   ============================================================================ */

/* Filter Controls */
.filter-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    margin-bottom: 15px;
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.filter-toggle input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.filter-toggle span {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.btn-export {
    padding: 6px 12px;
    background: #2196f3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s ease;
}

.btn-export:hover {
    background: #1976d2;
}

.btn-export:active {
    background: #0d47a1;
}

/* Clickable Items */
.clickable-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    margin: 4px 0;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.clickable-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.item-text {
    flex: 1;
}

.btn-inspect {
    padding: 4px 8px;
    background: rgba(33, 150, 243, 0.2);
    border: 1px solid #2196f3;
    border-radius: 3px;
    color: #2196f3;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s ease;
}

.btn-inspect:hover {
    background: rgba(33, 150, 243, 0.4);
    border-color: #1976d2;
    color: #1976d2;
}

/* Detail Modal */
.orphan-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--card-bg, #ffffff);
    border-radius: 8px;
    max-width: 600px;
    max-height: 80vh;
    overflow: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.modal-header h3 {
    margin: 0;
    color: #ff9800;
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    color: #999;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    color: var(--text-primary, #333);
}

.modal-body h4 {
    margin: 0 0 15px 0;
    color: var(--text-primary, #333);
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table tr {
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.detail-table tr:last-child {
    border-bottom: none;
}

.detail-key {
    padding: 8px;
    font-weight: bold;
    color: #2196f3;
    width: 40%;
    vertical-align: top;
}

.detail-value {
    padding: 8px;
    color: var(--text-secondary, #666);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    word-break: break-all;
}

/* Statistics Summary */
.orphan-statistics {
    padding: 15px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card.stat-warning {
    border-color: #ff9800;
    background: rgba(255, 152, 0, 0.1);
}

.stat-card.stat-ok {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
}

.stat-label {
    font-size: 0.9em;
    color: #999;
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--text-primary, #333);
    margin-bottom: 5px;
}

.stat-percent {
    font-size: 1.1em;
    color: #2196f3;
    font-weight: 600;
}

/* Collapsible Tree Sections */
.tree-collapsible .tree-header-orphan {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.tree-collapsible .tree-header-orphan:hover {
    background: rgba(255, 152, 0, 0.15);
}

.collapse-icon {
    display: inline-block;
    margin-right: 5px;
    transition: transform 0.2s ease;
    font-size: 0.8em;
    width: 16px;
    text-align: center;
}

.tree-children {
    margin-left: 20px;
    transition: all 0.3s ease;
}

.orphaned-item {
    border-left: 3px solid #ff9800;
    margin-left: 10px;
}

/* ============================================================================
   Package Viewer Tab
   ============================================================================ */

.package-viewer-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding: 0;
}

.package-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
    gap: 15px;
}

.package-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--laqi-navy);
    margin: 0;
}

.package-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.package-info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 10px;
    width: 100%;
}

@media (max-width: 1200px) {
    .package-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .package-info-grid {
        grid-template-columns: 1fr;
    }
}

.info-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid var(--laqi-navy);
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.info-card .info-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: block;
}

.info-card .info-value {
    font-weight: 600;
    color: var(--laqi-navy);
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    max-width: 100%;
}

.viewer-section {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 20px;
}

.viewer-section h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--laqi-navy);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.viewer-section .section-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Device Information Grid */
.device-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.device-info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid var(--laqi-yellow);
}

.device-info-item .info-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.device-info-item .info-value {
    font-weight: 600;
    color: var(--laqi-navy);
    font-size: 0.95rem;
    word-break: break-all;
}

/* Client Logs Viewer */
.client-logs-viewer {
    background: #1e1e1e;
    color: #f0f0f0;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    max-height: 500px;
    overflow-y: auto;
}

.client-logs-viewer .log-entry {
    margin-bottom: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.client-logs-viewer .log-timestamp {
    color: #7f8c8d;
    margin-right: 8px;
}

.client-logs-viewer .log-message {
    color: #f0f0f0;
}

.client-logs-viewer .empty-logs {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
    font-style: italic;
}

.export-btn {
    padding: 8px 16px;
    background: var(--status-info);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.export-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* Collection Metadata */
.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.metadata-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px;
    background: white;
    border-radius: 6px;
}

.metadata-item .info-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.metadata-item .info-value {
    font-weight: 600;
    color: var(--laqi-navy);
    font-size: 0.95rem;
}

/* Errors and Warnings Lists */
.errors-list,
.warnings-list {
    list-style: none;
    padding: 0;
    margin: 15px 0 0 0;
}

.errors-list li,
.warnings-list li {
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.errors-list li {
    background: rgba(231, 76, 60, 0.1);
    border-left: 4px solid var(--status-error);
    color: var(--status-error);
}

.warnings-list li {
    background: rgba(243, 156, 18, 0.1);
    border-left: 4px solid var(--status-warning);
    color: var(--status-warning);
}

.errors-list li::before {
    content: '⚠ ';
    font-weight: bold;
    margin-right: 8px;
}

.warnings-list li::before {
    content: '⚠ ';
    font-weight: bold;
    margin-right: 8px;
}

/* Text utility classes */
.text-error {
    color: var(--status-error);
    font-weight: 600;
}

.text-warning {
    color: var(--status-warning);
    font-weight: 600;
}

.text-success {
    color: var(--status-success);
    font-weight: 600;
}

/* Close button for viewer */
.btn-close-viewer {
    padding: 10px 20px;
    background: var(--text-secondary);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-close-viewer:hover {
    background: var(--laqi-navy);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(17, 61, 91, 0.3);
}

/* Responsive adjustments for package viewer */
@media (max-width: 768px) {
    .package-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .package-actions {
        width: 100%;
        flex-direction: column;
    }

    .package-actions button {
        width: 100%;
    }

    .package-info-grid,
    .device-info-grid,
    .metadata-grid {
        grid-template-columns: 1fr;
    }

    .client-logs-viewer {
        font-size: 0.8rem;
        padding: 15px;
    }
}

/* ============================================================================
   Toast Notifications
   ============================================================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: toastSlideIn 0.3s ease;
    font-weight: 500;
}

.toast.success {
    background: var(--status-success);
    color: white;
}

.toast.error {
    background: var(--status-error);
    color: white;
}

.toast.warning {
    background: var(--status-warning);
    color: white;
}

.toast.info {
    background: var(--status-info);
    color: white;
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 0.95rem;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.4rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    opacity: 1;
}

.toast.fade-out {
    animation: toastFadeOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastFadeOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ============================================================================
   Confirmation Modal
   ============================================================================ */

.confirm-modal .modal-content {
    max-width: 400px;
}

.confirm-modal .modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
}

.confirm-modal .modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--laqi-navy);
}

.confirm-modal .modal-body {
    padding: 25px;
    text-align: center;
}

.confirm-modal .modal-body p {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.confirm-modal .modal-actions {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-small {
    max-width: 400px;
}

/* ============================================================================
   Package Viewer Layout
   ============================================================================ */

.package-viewer-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    min-width: 0;
    max-width: 100%;
}

.package-viewer-content {
    flex: 1;
    padding-bottom: 20px;
    overflow-x: hidden;
    min-width: 0;
    max-width: 100%;
}

.package-viewer-content .viewer-section {
    margin-bottom: 20px;
    overflow-x: auto;
    min-width: 0;
}

.package-actions.sticky-footer {
    display: flex;
    gap: 10px;
    padding: 15px 0;
    border-top: 2px solid var(--border-color);
    margin-top: 20px;
    background: var(--bg-primary);
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ============================================================================
   Log Decoder - Table and Button Visibility Fixes
   ============================================================================ */

.log-decoder .dictionary-upload {
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 15px;
}

.log-decoder .dictionary-upload > div {
    flex-wrap: wrap;
}

.log-decoder .log-files-list {
    overflow-x: auto;
    margin-bottom: 15px;
}

.log-decoder .log-files-list .data-table {
    min-width: 100%;
    table-layout: auto;
}

.log-decoder .log-files-list .data-table td:last-child,
.log-decoder .log-files-list .data-table th:last-child {
    white-space: nowrap;
    width: 1%;
}

.log-decoder .log-files-list .data-table td:last-child .btn {
    margin: 2px 4px;
}

/* Decoded logs display area */
.log-decoder .decoded-logs {
    margin-top: 15px;
}

.log-decoder .decoded-logs-display {
    max-height: 500px;
    overflow-y: auto;
}
