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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #000000;
    color: #FFFFFF;
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

/* App Layout */
.app-layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: #0A0A0A;
    border-right: 1px solid #2A2A2A;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #2A2A2A;
    text-align: center;
}

.sidebar-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 12px;
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 12px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #1A1A1A;
    border-radius: 8px;
    font-size: 13px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #FF5722;
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.connected {
    background: #4CAF50;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.nav-menu {
    list-style: none;
    padding: 12px 0;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    color: #B0B0B0;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: #1A1A1A;
    color: #FFFFFF;
}

.nav-item.active {
    background: #1A1A1A;
    color: #FF5722;
    border-left-color: #FF5722;
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

/* Pages */
.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 0;
}

/* Create Button */
.btn-create {
    padding: 10px 20px;
    background: #FF5722;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-create:hover {
    background: #E64A19;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 25px;
}

.stat-card {
    background: #1A1A1A;
    border: 1px solid #2A2A2A;
    border-radius: 12px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    font-size: 28px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 87, 34, 0.1);
    border-radius: 10px;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #B0B0B0;
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #FFFFFF;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

/* Panels */
.panel {
    background: #1A1A1A;
    border: 1px solid #2A2A2A;
    border-radius: 12px;
    padding: 20px;
}

.panel.full-width {
    grid-column: 1 / -1;
}

.panel h3 {
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 15px;
}

/* Channel List */
.channel-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
}

.channel-item {
    padding: 12px 16px;
    background: #2A2A2A;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.channel-item:hover {
    background: #333333;
}

.channel-name {
    font-weight: 500;
    color: #FFFFFF;
}

.channel-count {
    background: #FF5722;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Client List */
.client-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
}

.client-item {
    padding: 12px 16px;
    background: #2A2A2A;
    border-radius: 8px;
    transition: background 0.2s;
}

.client-item:hover {
    background: #333333;
}

.client-username {
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 4px;
}

.client-info {
    font-size: 12px;
    color: #B0B0B0;
}

.client-channel {
    display: inline-block;
    background: #FF5722;
    color: white;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 11px;
    margin-left: 8px;
}

/* Log Container */
.log-container {
    background: #000000;
    border: 1px solid #2A2A2A;
    border-radius: 8px;
    padding: 15px;
    height: 300px;
    overflow-y: auto;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

.log-entry {
    padding: 6px 0;
    border-bottom: 1px solid #1A1A1A;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry.info {
    color: #2196F3;
}

.log-entry.success {
    color: #4CAF50;
}

.log-entry.warning {
    color: #FFC107;
}

.log-entry.error {
    color: #FF5722;
}

.log-time {
    color: #B0B0B0;
    margin-right: 10px;
}

/* Data Table */
.data-table {
    width: 100%;
    background: #1A1A1A;
    border: 1px solid #2A2A2A;
    border-radius: 12px;
    border-collapse: collapse;
    overflow: hidden;
}

.data-table thead {
    background: #111111;
}

.data-table th {
    padding: 14px 20px;
    text-align: left;
    font-weight: 600;
    color: #B0B0B0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #2A2A2A;
}

.data-table td {
    padding: 14px 20px;
    border-bottom: 1px solid #2A2A2A;
    color: #FFFFFF;
    font-size: 14px;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: #222222;
}

.data-table .actions-cell {
    display: flex;
    gap: 8px;
}

.data-table .btn-action {
    padding: 6px 14px;
    background: #2A2A2A;
    color: #B0B0B0;
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.data-table .btn-action:hover {
    background: #333;
    color: #FFFFFF;
}

.data-table .btn-action.qr {
    color: #FF5722;
    border-color: #FF5722;
}

.data-table .btn-action.qr:hover {
    background: #FF5722;
    color: white;
}

.data-table .btn-action.edit {
    color: #2196F3;
    border-color: #2196F3;
}

.data-table .btn-action.edit:hover {
    background: #2196F3;
    color: white;
}

.data-table .btn-action.delete {
    color: #f44336;
    border-color: #f44336;
}

.data-table .btn-action.delete:hover {
    background: #f44336;
    color: white;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1A1A1A;
    border: 1px solid #2A2A2A;
    border-radius: 12px;
    padding: 28px;
    min-width: 400px;
    max-width: 90%;
}

.modal-content h2 {
    margin-bottom: 8px;
    font-size: 20px;
    color: #FFFFFF;
}

.modal-subtitle {
    color: #B0B0B0;
    font-size: 14px;
    margin-bottom: 20px;
}

.modal-content input {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 16px;
    background: #0A0A0A;
    border: 1px solid #2A2A2A;
    border-radius: 8px;
    color: #FFFFFF;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.modal-content input:focus {
    border-color: #FF5722;
}

.modal-content input::placeholder {
    color: #666;
}

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

.btn-primary {
    padding: 10px 24px;
    background: #FF5722;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #E64A19;
}

.btn-secondary {
    padding: 10px 24px;
    background: #2A2A2A;
    color: #B0B0B0;
    border: 1px solid #333;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* QR Code Styles */
.qr-code-container {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin: 16px 0;
    display: flex;
    justify-content: center;
}

.qr-credentials {
    background: #0A0A0A;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.qr-field {
    margin-bottom: 10px;
}

.qr-field:last-child {
    margin-bottom: 0;
}

.qr-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.qr-value {
    color: #FFFFFF;
    font-size: 14px;
}

.qr-value.mono {
    font-family: 'Monaco', 'Courier New', monospace;
}

/* Settings */
.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #2A2A2A;
    border-radius: 8px;
}

.settings-info {
    flex: 1;
}

.settings-label {
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 4px;
}

.settings-description {
    font-size: 13px;
    color: #B0B0B0;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
    margin-left: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #333;
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #FF5722;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* Status Messages */
.status-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

.status-message.success {
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.status-message.error {
    background: rgba(255, 87, 34, 0.15);
    color: #FF5722;
    border: 1px solid rgba(255, 87, 34, 0.3);
}

.status-message.warning {
    background: rgba(255, 193, 7, 0.15);
    color: #FFC107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #B0B0B0;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1A1A1A;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #2A2A2A;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #333333;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #2A2A2A;
    }

    .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 20px;
    }

    .sidebar-header h1 {
        margin-bottom: 0;
    }

    .nav-menu {
        display: flex;
        padding: 0;
        overflow-x: auto;
    }

    .nav-item {
        padding: 10px 16px;
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
    }

    .nav-item.active {
        border-left-color: transparent;
        border-bottom-color: #FF5722;
    }

    .main-content {
        padding: 20px;
        overflow-y: auto;
        height: auto;
        flex: 1;
    }

    body {
        overflow: auto;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .modal-content {
        min-width: auto;
        margin: 20px;
    }

    .data-table .actions-cell {
        flex-direction: column;
        gap: 4px;
    }
}
