* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --success: #10b981;
    --danger: #ef4444;
    --bg: #f5f7fa;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
}

/* Dark Theme */
body.dark-theme {
    --bg: #1a1a1a;
    --text: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border: #333;
}

body.dark-theme .card,
body.dark-theme .sql-editor,
body.dark-theme .user-dropdown-menu {
    background: #2a2a2a;
}

body.dark-theme .sql-sidebar,
body.dark-theme .sql-editor-header,
body.dark-theme .sql-results-header {
    background: #222;
    border-color: #333;
}

body.dark-theme .sql-sidebar-header {
    background: #2a2a2a;
    border-color: #333;
}

body.dark-theme .db-name:hover,
body.dark-theme .table-item:hover {
    background: #333;
}

body.dark-theme .table-item {
    color: #a0a0a0;
}

body.dark-theme .table-item:hover {
    color: #e0e0e0;
}

body.dark-theme .sql-editor-textarea {
    background: #1a1a1a;
    color: #e0e0e0;
}

body.dark-theme .btn-icon-sm {
    background: #333;
    border-color: #444;
    color: #e0e0e0;
}

body.dark-theme .btn-icon-sm:hover {
    background: #444;
}

body.dark-theme .sql-results-content {
    background: #2a2a2a;
}

body.dark-theme .statusbar {
    background: #2a2a2a;
    border-color: #333;
}

body.dark-theme th {
    background: #333;
    color: #e0e0e0;
}

body.dark-theme td {
    border-color: #333;
    color: #a0a0a0;
}

body.dark-theme tr:hover {
    background: #333;
}

body.dark-theme .info-message {
    background: #2a2a2a;
    color: #a0a0a0;
}

body.dark-theme .info-message.error {
    color: #ff6b6b;
}

body.dark-theme .device-item {
    background: #333;
}

body.dark-theme .devices-section {
    background: #2a2a2a;
}

/* Login Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-box {
    background: white;
    border-radius: 10px;
    padding: 40px;
    width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.error-message.show {
    display: block;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.btn-login:hover {
    opacity: 0.9;
}

/* App Layout */
#app {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 180px;
    background: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar-header {
    padding: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header .logo {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    transition: all 0.3s;
}

.sidebar.collapsed .logo {
    width: 44px;
    height: 44px;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.3s;
    font-size: 13px;
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-item.active {
    background: var(--sidebar-hover);
    color: white;
    border-left: 3px solid var(--primary);
}

.nav-icon {
    font-size: 16px;
    margin-right: 10px;
    flex-shrink: 0;
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar .nav-text {
        display: none;
    }
    
    .sidebar .logo {
        width: 44px;
        height: 44px;
    }
    
    .sidebar.mobile-open {
        width: 180px;
    }
    
    .sidebar.mobile-open .nav-text {
        display: inline;
    }
    
    .sidebar.mobile-open .logo {
        width: 64px;
        height: 64px;
    }
}

.mobile-menu-btn {
    display: none;
}

/* Main Wrapper */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top Bar */
.topbar {
    background: var(--sidebar-bg);
    padding: 0 20px 0 1px;
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.topbar-left, .topbar-center, .topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar-center {
    flex: 1;
    justify-content: center;
    gap: 30px;
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.topbar-status .status-label {
    color: rgba(255,255,255,0.6);
    font-weight: 500;
}

.topbar-status .status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.3s;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.1);
}

.last-update, .user-email {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.user-dropdown-btn:hover {
    background: rgba(255,255,255,0.2);
}

.user-icon {
    font-size: 16px;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.3s;
}

.user-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    z-index: 1000;
}

.user-dropdown.active .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
}

.dropdown-item:first-child {
    border-radius: 6px 6px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 6px 6px;
}

.dropdown-item:hover {
    background: var(--bg);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 5px 0;
}

/* Status Bar */
.statusbar {
    background: white;
    padding: 15px 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 30px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: #e5e7eb;
    color: var(--text-secondary);
}

.status-badge.active {
    background: #d1fae5;
    color: var(--success);
}

.status-badge.inactive {
    background: #fee2e2;
    color: var(--danger);
}

.status-badge.online {
    background: #d1fae5;
    color: var(--success);
}

.status-badge.offline {
    background: #fee2e2;
    color: var(--danger);
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 20px;
    overflow: auto;
    min-height: 0;
}

/* Card */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card h3 {
    margin-bottom: 15px;
}

/* Devices */
.devices-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.device-count {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

.devices-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.device-item {
    display: grid;
    grid-template-columns: 150px 1fr 200px 120px;
    gap: 15px;
    padding: 15px;
    background: var(--bg);
    border-radius: 8px;
    align-items: center;
}

.device-id {
    font-family: monospace;
    font-weight: 600;
}

.device-name {
    color: var(--text-secondary);
}

.device-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.device-status {
    text-align: right;
}

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
}

.status-dot::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online::before {
    background: var(--success);
}

.status-dot.offline::before {
    background: var(--danger);
}

/* SQL Viewer - phpMyAdmin Style */
.sql-editor {
    display: flex;
    height: calc(100vh - 200px);
    min-height: 400px;
    gap: 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.sql-sidebar {
    width: 200px;
    background: #f8f9fa;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sql-sidebar-header {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    background: white;
}

.sql-sidebar-header h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.db-tree {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.db-item {
    margin-bottom: 8px;
}

.db-name {
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.db-name:hover {
    background: #e9ecef;
}

.db-icon {
    font-size: 14px;
}

.db-tables {
    margin-left: 16px;
    margin-top: 4px;
}

.table-item {
    padding: 5px 8px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.table-item:hover {
    background: #e9ecef;
    color: var(--text);
}

.table-icon {
    font-size: 12px;
}

.sql-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.sql-editor-panel {
    height: 200px;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border);
}

.sql-editor-header {
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
}

.sql-editor-actions {
    display: flex;
    gap: 5px;
}

.btn-icon-sm {
    background: white;
    border: 1px solid var(--border);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-icon-sm:hover {
    background: var(--bg);
}

.sql-editor-textarea {
    flex: 1;
    padding: 15px;
    border: none;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: none;
    outline: none;
}

.sql-results-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sql-results-header {
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
}

.row-count-badge {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.sql-results-content {
    flex: 1;
    overflow: auto !important;
    padding: 0;
    min-height: 0;
    position: relative;
}

.sql-results-content .table-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
}

.sql-results-content .info-message {
    padding: 20px;
    text-align: center;
    margin: 15px;
}

.sql-results-content .info-message.error {
    color: var(--danger);
}

.sql-results-content table th {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Old SQL Viewer Styles - Remove */
.sql-controls,
.quick-queries,
.sql-query,
.sql-actions,
.results-header {
    display: none;
}

/* Table Styles */
.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 600px;
}

table {
    width: 100%;
    min-width: max-content;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}

th {
    background: var(--bg);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

tr:hover {
    background: #f9fafb;
}

.info-message {
    background: #dbeafe;
    color: #1e40af;
    padding: 15px;
    border-radius: 6px;
}

.no-data {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 24px;
    font-weight: 600;
}

/* Device Management */
.device-management {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.device-tables {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.device-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: all 0.3s;
}

.device-section.collapsed .section-content {
    max-height: 60px;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--bg);
    cursor: pointer;
    user-select: none;
}

.section-header:hover {
    background: #e9ecef;
}

.section-header h3 {
    margin: 0;
    font-size: 16px;
}

.count-badge {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.section-content {
    padding: 15px;
    transition: max-height 0.3s;
}

.btn-sm {
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-sm:hover {
    opacity: 0.9;
}

.btn-sm.btn-success {
    background: var(--success);
    margin-right: 5px;
}

/* Device Detail */
.device-detail {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--primary);
    color: white;
}

.detail-header h3 {
    margin: 0;
    font-size: 16px;
}

.btn-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
}

.btn-close:hover {
    opacity: 0.8;
}

.detail-content {
    padding: 20px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 20px;
}

.detail-section h4 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
}

.form-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.form-row label {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-secondary);
}

.form-row input,
.form-row textarea {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
}

.form-row input:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row input[readonly] {
    background: var(--bg);
    color: var(--text-secondary);
}

.detail-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.btn-primary {
    padding: 10px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    opacity: 0.9;
}

.detail-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.detail-table-section h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
}

.detail-table-section .table-wrapper {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.detail-table-section table {
    font-size: 12px;
}

.detail-table-section th {
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 1;
}

/* Dark Theme - Device Management */
body.dark-theme .device-section,
body.dark-theme .device-detail {
    background: #2a2a2a;
}

body.dark-theme .section-header {
    background: #333;
}

body.dark-theme .section-header:hover {
    background: #3a3a3a;
}

body.dark-theme .detail-header {
    background: var(--primary);
}

body.dark-theme .form-row input,
body.dark-theme .form-row textarea {
    background: #1a1a1a;
    border-color: #444;
    color: #e0e0e0;
}

body.dark-theme .form-row input[readonly] {
    background: #333;
    color: #a0a0a0;
}

body.dark-theme .detail-actions {
    border-color: #444;
}

body.dark-theme .detail-table-section .table-wrapper {
    border-color: #444;
}

body.dark-theme .detail-table-section th {
    background: #333;
}

/* Responsive */
@media (max-width: 1024px) {
    .detail-grid,
    .detail-tables {
        grid-template-columns: 1fr;
    }
}


/* Remote Control Page */
.remote-control {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.device-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.device-selector label {
    font-weight: 600;
    font-size: 14px;
}

.device-selector select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    min-width: 250px;
}

/* Device Cards */
.device-cards-container {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 15px;
}

.device-cards {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 10px 5px;
}

.device-cards::-webkit-scrollbar {
    height: 8px;
}

.device-cards::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 4px;
}

.device-cards::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.device-card {
    min-width: 280px;
    max-width: 280px;
    background: var(--bg);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.device-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.device-card.selected {
    border-color: var(--primary);
    background: #f0f4ff;
}

.device-card-preview {
    width: 100%;
    height: 150px;
    background: #ddd;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #999;
}

.device-card-info h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
}

.device-card-info p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.device-card-status {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.scroll-btn:hover {
    background: var(--bg);
}

.scroll-left {
    left: 10px;
}

.scroll-right {
    right: 10px;
}

/* Screen Container */
.screen-container {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 600px;
}

#device-screen {
    max-width: 100%;
    height: auto;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: crosshair;
}

.screen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.screen-overlay.hidden {
    display: none;
}

.overlay-message {
    text-align: center;
}

.overlay-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 15px;
}

.overlay-message p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Android Navigation */
.android-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px 30px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.nav-icon {
    font-size: 24px;
}

.nav-label {
    font-size: 12px;
    font-weight: 600;
}

/* Management Features */
.management-features {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 20px;
}

.management-features h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
}

.feature-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.feature-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.feature-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 32px;
}

.feature-label {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-around;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.status-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.status-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
}

/* Dark Theme - Remote Control */
body.dark-theme .control-header,
body.dark-theme .device-cards-container,
body.dark-theme .screen-container,
body.dark-theme .android-nav,
body.dark-theme .management-features,
body.dark-theme .status-bar {
    background: #2a2a2a;
}

body.dark-theme .device-card {
    background: #333;
}

body.dark-theme .device-card.selected {
    background: #1a2a4a;
}

body.dark-theme .nav-btn,
body.dark-theme .feature-btn {
    background: #333;
    border-color: #444;
}

body.dark-theme .screen-overlay {
    background: rgba(42,42,42,0.95);
}

body.dark-theme #device-screen {
    border-color: #444;
}

/* Responsive */
@media (max-width: 768px) {
    .device-cards {
        gap: 10px;
    }
    
    .device-card {
        min-width: 220px;
        max-width: 220px;
    }
    
    .feature-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .android-nav {
        gap: 10px;
    }
    
    .nav-btn {
        padding: 12px 20px;
    }
}

/* ===== Message Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

#message-modal.modal-overlay {
    z-index: 10001;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-container,
.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    min-width: 400px;
    max-width: 500px;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.modal-body {
    padding: 24px;
    color: var(--text);
    line-height: 1.6;
}

.modal-body p {
    margin: 0;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
}

.btn-secondary {
    padding: 10px 20px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: var(--text-secondary);
}

.btn-primary {
    padding: 10px 20px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Dark Theme Modal */
body.dark-theme .modal-container,
body.dark-theme .modal-content {
    background: #2a2a2a;
}

body.dark-theme .modal-header,
body.dark-theme .modal-footer {
    border-color: #333;
}

body.dark-theme .btn-secondary {
    background: #333;
    border-color: #444;
    color: #e0e0e0;
}

body.dark-theme .btn-secondary:hover {
    background: #444;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
