/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    font-size: 1.5rem;
    color: #667eea;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-online {
    background: #4CAF50;
}

.status-offline {
    background: #f44336;
}

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

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.clients-section {
    grid-column: 1 / -1;
}

.remote-screen-section {
    grid-column: 1 / -1;
}

.chat-section {
    grid-column: 1 / -1;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.card.full-screen {
    height: 600px;
    display: flex;
    flex-direction: column;
}

.card h2 {
    margin-bottom: 1.5rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
}

.card h2 i {
    color: #667eea;
}

/* Input Groups */
.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.input-group input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    background: #f8f9fa;
    color: #333;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.btn-success {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
}

.btn-icon {
    padding: 0.5rem;
    min-width: auto;
}

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

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

.btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Server Controls */
.server-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.server-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.connection-id-display label {
    font-weight: 600;
    color: #555;
    margin-bottom: 0.5rem;
    display: block;
}

.id-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#my-connection-id {
    font-family: 'Courier New', monospace;
    font-size: 1.25rem;
    font-weight: bold;
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    letter-spacing: 2px;
}

.server-buttons {
    display: flex;
    gap: 1rem;
}

#server-status {
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    background: #f44336;
    color: white;
}

.server-running #server-status {
    background: #4CAF50;
}

/* Clients List */
.clients-list {
    min-height: 100px;
}

.no-clients {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

.client-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border-left: 4px solid #667eea;
}

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

/* Chat Interface */
.chat-messages {
    height: 300px;
    overflow-y: auto;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.8);
    margin-bottom: 1rem;
}

.no-messages {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

.chat-message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.message-header strong {
    color: #667eea;
}

.message-header small {
    color: #666;
}

.message-content {
    color: #333;
    line-height: 1.4;
}

.chat-input-group {
    display: flex;
    gap: 0.5rem;
}

.chat-input-group input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

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

.chat-input-group .btn {
    padding: 0.75rem;
    min-width: auto;
}

/* Remote Screen */
.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.screen-controls {
    display: flex;
    gap: 0.5rem;
}

.screen-container {
    flex: 1;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

#remote-screen {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.modal-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #666;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.close-btn:hover {
    background: #f5f5f5;
}

.modal-body {
    padding: 2rem;
}

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

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.setting-group select,
.setting-group input[type="range"] {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 1rem;
}

.setting-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.loading-spinner p {
    font-size: 1.25rem;
    font-weight: 500;
}

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

.toast {
    background: white;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #667eea;
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

.toast.success {
    border-left-color: #4CAF50;
}

.toast.error {
    border-left-color: #f44336;
}

.toast.warning {
    border-left-color: #ff9800;
}

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

/* Help Text */
.help-text {
    color: #666;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    line-height: 1.4;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    
    .app-header {
        padding: 1rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .server-buttons {
        flex-direction: column;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .client-item {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .client-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* File Transfer */
.file-transfer-section-wrapper {
    grid-column: 1 / -1;
}

.file-transfer-section-wrapper h2 {
    margin-bottom: 1rem;
}

.transfer-status {
    margin-top: 8px;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    min-height: 20px;
}

.transfer-status.sending {
    background: #1a3a5c;
    color: #4da6ff;
}

.transfer-status.receiving {
    background: #1a4a2e;
    color: #4dff88;
}

.transfer-status.complete {
    background: #1a4a2e;
    color: #4dff88;
}

.transfer-status.error {
    background: #5c1a1a;
    color: #ff4d4d;
}