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

body {
    font-family: 'Roboto', Arial, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #333;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Cabeçalho */
.header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

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

.logo h1 {
    color: #1e3c72;
    font-weight: 700;
    font-size: 1.8em;
    margin-bottom: 5px;
}

.logo p {
    color: #666;
    font-weight: 300;
    font-size: 0.9em;
}

.version-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.demo-badge {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.github-link {
    color: #333;
    text-decoration: none;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.github-link:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.welcome-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    opacity: 1;
    transition: opacity 0.5s ease;
}

.welcome-content {
    padding: 20px 30px;
}

.welcome-content h3 {
    margin-bottom: 10px;
    font-size: 1.3em;
}

.welcome-content p {
    margin-bottom: 8px;
    opacity: 0.9;
}

.welcome-content a {
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
}

.footer {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-top: 30px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.footer-content {
    padding: 20px 30px;
    text-align: center;
    color: white;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.footer-links a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Mensagens de erro e servidor */
.error-message, .server-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(220, 53, 69, 0.95);
    color: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    max-width: 400px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    animation: slideInRight 0.3s ease-out;
}

.server-message {
    background: rgba(23, 162, 184, 0.95);
}

.error-content, .message-content {
    margin: 0;
}

.error-content h3 {
    margin-bottom: 10px;
    font-size: 1.2em;
}

.error-content ul {
    margin: 10px 0 10px 20px;
}

.error-content code {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

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

.connection-status {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.05);
    font-size: 0.9em;
    font-weight: 500;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dc3545;
    animation: pulse 2s infinite;
}

.status-indicator.connected .status-dot {
    background: #28a745;
}

.status-indicator.warning .status-dot {
    background: #ffc107;
}

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

/* Botões */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

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

.btn-secondary:hover {
    background: #545b62;
}

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

.btn-success:hover {
    background: #1e7e34;
}

/* Painel de Controle */
.control-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.panel-section h3 {
    color: #1e3c72;
    margin-bottom: 15px;
    font-weight: 600;
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-weight: 500;
    color: #555;
    font-size: 0.9em;
}

.filter-group select {
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    background: white;
    font-size: 0.9em;
    transition: border-color 0.3s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: #007bff;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auto-scroll {
    margin-top: 10px;
}

.auto-scroll label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #555;
    cursor: pointer;
}

/* Estatísticas */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-value {
    font-size: 2em;
    font-weight: 700;
    color: #1e3c72;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

/* Painel de Canais */
.channels-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.channels-panel h3 {
    color: #1e3c72;
    margin-bottom: 20px;
    font-weight: 600;
}

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.channel-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.channel-card.active {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    border-color: #17a2b8;
    transform: scale(1.05);
}

.channel-number {
    font-weight: 700;
    color: #1e3c72;
    margin-bottom: 5px;
}

.channel-status {
    font-size: 0.8em;
    color: #666;
}

.channel-activity {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.channel-activity-bar {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #17a2b8);
    width: 0%;
    transition: width 0.3s ease;
}

/* Log de Mensagens */
.log-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
}

.log-header h3 {
    font-weight: 600;
}

.log-info {
    display: flex;
    gap: 20px;
    font-size: 0.9em;
    opacity: 0.9;
}

.log-container {
    height: 500px;
    overflow-y: auto;
    background: #f8f9fa;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

.log-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-style: italic;
}

.log-entry {
    display: grid;
    grid-template-columns: 120px 80px 80px 120px 80px 80px 1fr;
    gap: 15px;
    padding: 8px 15px;
    border-bottom: 1px solid #dee2e6;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.log-entry:hover {
    background: rgba(0, 123, 255, 0.1);
}

.log-entry.note-on {
    border-left: 4px solid #28a745;
}

.log-entry.note-off {
    border-left: 4px solid #dc3545;
}

.log-entry.control-change {
    border-left: 4px solid #ffc107;
}

.log-entry.pitch-bend {
    border-left: 4px solid #17a2b8;
}

.log-timestamp {
    color: #666;
    font-weight: 500;
}

.log-channel {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border-radius: 4px;
    text-align: center;
    padding: 2px 8px;
    font-weight: 600;
}

.log-type {
    color: #495057;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8em;
}

.log-note {
    font-weight: 600;
    color: #1e3c72;
}

.log-velocity {
    color: #6c757d;
}

.log-slave {
    background: #6c757d;
    color: white;
    border-radius: 4px;
    text-align: center;
    padding: 2px 6px;
    font-weight: 500;
    font-size: 0.8em;
}

.log-raw {
    color: #495057;
    font-family: monospace;
    font-size: 0.8em;
}

/* 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);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 80%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    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 25px;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    font-weight: 600;
}

.modal-close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 25px;
}

/* Scrollbar personalizada */
.log-container::-webkit-scrollbar {
    width: 8px;
}

.log-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.log-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsivo */
@media (max-width: 1200px) {
    .control-panel {
        grid-template-columns: 1fr;
    }
    
    .log-entry {
        grid-template-columns: 100px 70px 70px 100px 70px 70px 1fr;
        gap: 10px;
        font-size: 0.8em;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .stats-panel {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filters {
        grid-template-columns: 1fr;
    }
    
    .channels-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .log-entry {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    .log-container {
        height: 400px;
    }
}

/* Animações */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.log-entry.new {
    animation: fadeIn 0.3s ease;
}

.stat-card.updated .stat-value {
    animation: pulse-scale 0.5s ease;
}

@keyframes pulse-scale {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}