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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

#app {
    min-height: 100vh;
}

.screen {
    display: block;
}

.screen.hidden {
    display: none;
}

/* Login Screen */
#loginScreen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    padding: 40px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.input-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.input-field:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5568d3;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-block {
    width: 100%;
}

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

/* Navbar */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand h2 {
    font-size: 20px;
}

.navbar-menu {
    display: flex;
    gap: 15px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Sections */
.section {
    margin-bottom: 30px;
}

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

.section-header h3 {
    font-size: 18px;
}

/* Devices Grid */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.device-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s;
}

.device-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.device-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.device-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.device-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.device-status.online {
    background-color: #28a745;
    color: white;
}

.device-status.offline {
    background-color: #dc3545;
    color: white;
}

.device-info {
    font-size: 12px;
    color: #666;
    line-height: 1.8;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal:not(.hidden) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 18px;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Tabs */
.tab-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    padding: 10px 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

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

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.info-item {
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.info-label {
    font-size: 12px;
    color: #999;
    font-weight: 500;
    text-transform: uppercase;
}

.info-value {
    font-size: 16px;
    color: #333;
    font-weight: 600;
    margin-top: 5px;
    word-break: break-all;
}

/* List Container */
.list-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow-y: auto;
    max-height: 400px;
}

.list-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.list-item-name {
    font-weight: 500;
    color: #333;
}

.list-item-details {
    font-size: 12px;
    color: #999;
}

.list-item-actions {
    display: flex;
    gap: 8px;
}

.list-item-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* Files Controls */
.files-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.files-controls .input-field {
    flex: 1;
}

/* Logs Viewer */
.logs-viewer {
    width: 100%;
    height: 300px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    resize: vertical;
    background-color: #f9f9f9;
}

/* Loading Indicator */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.loading-indicator.hidden {
    display: none;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
}

.toast {
    background-color: #333;
    color: white;
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    background-color: #28a745;
}

.toast.error {
    background-color: #dc3545;
}

.toast.info {
    background-color: #17a2b8;
}

/* Error Message */
.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 10px;
    text-align: center;
}

.loading {
    text-align: center;
    color: #999;
    padding: 40px;
}

.hidden {
    display: none !important;
}

/* Screenshot Styles */
.screenshot-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    background-color: #f9f9f9;
    border-radius: 4px;
    overflow: auto;
}

.screenshot-view {
    text-align: center;
    padding: 20px;
}

.screenshot-timestamp {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
}

.screenshot-image {
    max-width: 100%;
    max-height: 600px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 10px 0;
}

.screenshot-size {
    font-size: 12px;
    color: #999;
    margin-top: 10px;
}

.screenshot-controls {
    margin-bottom: 15px;
}

/* Live Screen Styles */
.livescreen-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    background-color: #1a1a1a;
    border-radius: 4px;
    overflow: auto;
}

.livescreen-view {
    position: relative;
    max-width: 100%;
    text-align: center;
}

.livescreen-image {
    max-width: 100%;
    max-height: 600px;
    border: 2px solid #00aa00;
    border-radius: 2px;
}

.livescreen-fps {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 170, 0, 0.8);
    color: #00ff00;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-family: monospace;
}

.livescreen-controls {
    margin-bottom: 15px;
}

/* History Styles */
.history-list {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fafafa;
}

.history-summary {
    padding: 10px 15px;
    background-color: #e8f4f8;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
    color: #0066cc;
}

.history-item {
    padding: 12px 15px;
    border-bottom: 1px solid #ddd;
    display: flex;
    gap: 15px;
    align-items: flex-start;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.history-item:hover {
    background-color: #f0f8ff;
}

.history-number {
    color: #999;
    min-width: 50px;
    text-align: right;
    flex-shrink: 0;
}

.history-command {
    flex-grow: 1;
    color: #333;
    word-break: break-all;
    white-space: pre-wrap;
}

.history-type {
    background-color: #e3f2fd;
    color: #1976d2;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    min-width: 70px;
    text-align: center;
    flex-shrink: 0;
}

.history-controls {
    margin-bottom: 15px;
}

/* Terminal Styles */
.terminal-container {
    display: flex;
    flex-direction: column;
    height: 400px;
    border: 1px solid #333;
    border-radius: 4px;
    background-color: #1a1a1a;
    font-family: 'Courier New', monospace;
    color: #00ff00;
    overflow: hidden;
}

.terminal-output {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background-color: #0a0a0a;
    font-size: 13px;
    line-height: 1.6;
}

.terminal-line {
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 2px;
}

.terminal-line.terminal-normal {
    color: #00ff00;
}

.terminal-line.terminal-error {
    color: #ff6b6b;
}

.terminal-line.terminal-success {
    color: #51cf66;
}

.terminal-input-group {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-top: 1px solid #333;
    background-color: #1a1a1a;
}

.terminal-input {
    flex: 1;
    background-color: #0a0a0a;
    border: 1px solid #333;
    color: #00ff00;
    padding: 8px 12px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.terminal-input:focus {
    outline: none;
    border-color: #00ff00;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
}

.terminal-input::placeholder {
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .devices-grid {
        grid-template-columns: 1fr;
    }

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

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .tab-buttons {
        flex-wrap: wrap;
    }

    .files-controls {
        flex-direction: column;
    }

    .navbar {
        flex-direction: column;
        gap: 15px;
    }

    .section-header {
        flex-direction: column;
        gap: 10px;
    }
}
