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

:root {
    --primary: #e74c3c;
    --primary-dark: #c0392b;
    --secondary: #3498db;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --dark: #1a1a2e;
    --darker: #16162a;
    --darkest: #0f0f1a;
    --light: #edf2f7;
    --gray: #6c757d;
    --gray-dark: #343a40;
    --border-color: #2d2d44;
    --card-bg: #1e1e32;
    --sidebar-width: 260px;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--darkest);
    color: var(--light);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
}

/* Login Screen */
#login-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--darkest) 0%, var(--dark) 100%);
}

.login-container {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-color);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo i {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.login-logo h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-logo p {
    color: var(--gray);
    font-size: 0.9rem;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

.input-group input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--darker);
    color: var(--light);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--gray);
    font-size: 0.9rem;
}

.input-group label + input {
    padding-left: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

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

.btn-secondary:hover {
    background: #2980b9;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-icon {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
}

.error-message {
    color: var(--danger);
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Dashboard Layout */
#dashboard-screen {
    display: none;
}

#dashboard-screen.active {
    display: flex;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--darker);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header i {
    font-size: 2rem;
    color: var(--primary);
}

.sidebar-header span {
    font-size: 1.5rem;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: var(--gray);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--dark);
    color: var(--light);
}

.nav-item.active {
    background: var(--dark);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-info i {
    font-size: 1.5rem;
    color: var(--primary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: 100vh;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.view-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.view-header h2 i {
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.badge {
    background: var(--primary);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Clients Grid */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.client-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.client-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
}

.client-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.client-icon {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.client-title h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.client-title .client-id {
    color: var(--gray);
    font-size: 0.875rem;
    font-family: monospace;
}

.client-status {
    margin-left: auto;
}

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

.status-dot.connected {
    background: var(--secondary);
}

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

.client-info {
    margin-bottom: 1rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--gray);
}

.client-actions {
    display: flex;
    gap: 0.75rem;
}

.client-actions .btn {
    flex: 1;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--light);
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--dark);
    border-radius: 16px;
    max-width: 90%;
    max-height: 90%;
    overflow: hidden;
}

.remote-modal-content {
    width: 95vw;
    height: 95vh;
    display: flex;
    flex-direction: column;
}

/* Remote Header */
.remote-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--darker);
    border-bottom: 1px solid var(--border-color);
}

.remote-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#remote-client-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.remote-toolbar {
    display: flex;
    gap: 0.5rem;
}

.tool-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--card-bg);
    color: var(--light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: var(--primary);
}

.tool-btn.danger:hover {
    background: var(--danger);
}

.tool-btn.active {
    background: var(--primary);
}

/* Remote Screen */
.remote-screen-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

#remote-screen {
    max-width: 100%;
    max-height: 100%;
    cursor: default;
}

.remote-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--gray);
}

.remote-loading i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

/* Side Panels */
.side-panel {
    display: none;
    position: absolute;
    right: 0;
    top: 0;
    width: 400px;
    height: 100%;
    background: var(--darker);
    border-left: 1px solid var(--border-color);
    flex-direction: column;
    z-index: 10;
}

.side-panel.active {
    display: flex;
}

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

.panel-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.close-panel {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
}

.close-panel:hover {
    color: var(--light);
}

.panel-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* File Manager */
.path-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.path-bar input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--dark);
    color: var(--light);
    font-family: monospace;
}

.file-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--dark);
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.file-item:hover {
    background: var(--card-bg);
}

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

.file-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.file-item.folder i {
    color: var(--warning);
}

.file-item.file i {
    color: var(--secondary);
}

.file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: var(--gray);
    font-size: 0.8rem;
}

.file-actions {
    margin-top: 1rem;
}

/* Terminal */
.terminal-output {
    flex: 1;
    background: #0a0a0a;
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    color: #0f0;
}

.terminal-input-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    background: #0a0a0a;
    padding: 0.5rem;
    border-radius: 8px;
}

.terminal-input-container .prompt {
    color: var(--success);
    font-family: monospace;
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #0f0;
    font-family: monospace;
    font-size: 0.875rem;
    outline: none;
}

/* Clipboard Panel */
#clipboard-content {
    flex: 1;
    background: var(--dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    color: var(--light);
    font-family: inherit;
    resize: none;
    margin-bottom: 1rem;
}

/* Settings */
.settings-content {
    max-width: 600px;
}

.settings-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.settings-section h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.settings-section p {
    color: var(--gray);
    margin-bottom: 1rem;
}

.settings-section .btn {
    width: auto;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    border-left: 4px solid var(--primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
    min-width: 300px;
}

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

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

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

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Sessions List */
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.session-item {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.session-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.session-info i {
    font-size: 1.5rem;
    color: var(--secondary);
}

/* Fullscreen */
.remote-modal-content.fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .sidebar-header span,
    .nav-item span,
    .user-info span {
        display: none;
    }

    .main-content {
        margin-left: 60px;
    }

    .side-panel {
        width: 100%;
    }
}
