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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    padding: 20px;
    position: relative;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 20px;
    position: relative;
}

/* Seção de Contatos (Lateral Direita) */
.contacts-sidebar {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 80px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.contact-card {
    width: 70px;
    height: 70px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.contact-card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.contact-card .contact-icon {
    font-size: 24px;
    margin-bottom: 2px;
    transition: all 0.3s ease;
}

.contact-card:hover .contact-icon {
    transform: scale(1.2);
}

.contact-label {
    font-size: 10px;
    font-weight: bold;
    text-align: center;
    line-height: 1;
    opacity: 0.9;
}

/* Cards específicos com cores */
.instagram-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.whatsapp-card {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: white;
}

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

.thanks-card {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
}

/* Tooltip de aviso para WhatsApp */
.warning-tooltip {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 235, 59, 0.95);
    color: #333;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 9px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
}

.whatsapp-card:hover .warning-tooltip {
    opacity: 1;
    top: -45px;
}

/* Animação de pulso para o botão de agradecimento */
.thanks-card {
    animation: gentlePulse 3s ease-in-out infinite;
}

@keyframes gentlePulse {
    0%, 100% { 
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    }
    50% { 
        box-shadow: 0 4px 25px rgba(255, 107, 107, 0.6);
    }
}

/* Layout principal ajustado */
.main-content {
    flex: 1;
    max-width: calc(100% - 120px);
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Modal de Email */
.email-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    animation: fadeIn 0.3s ease-out;
}

.email-overlay.show {
    display: flex;
}

.email-modal {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    animation: modalSlideUp 0.3s ease-out;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.email-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.email-header h2 {
    margin: 0;
    font-size: 20px;
}

.close-email {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.close-email:hover {
    background: rgba(255, 255, 255, 0.2);
}

.email-content {
    padding: 30px;
    text-align: center;
}

.email-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.email-address {
    margin-bottom: 25px;
}

.email-address label {
    display: block;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 16px;
}

.email-text {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border: 2px dashed #667eea;
    font-family: monospace;
    font-size: 16px;
    color: #2c3e50;
    font-weight: bold;
    word-break: break-all;
}

.email-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.copy-btn, .send-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.copy-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

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

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.copy-feedback {
    background: #d4edda;
    color: #155724;
    padding: 10px;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s;
    font-weight: bold;
}

.copy-feedback.show {
    opacity: 1;
}

/* Modal de Agradecimento */
.thanks-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    animation: fadeIn 0.3s ease-out;
}

.thanks-overlay.show {
    display: flex;
}

.thanks-modal {
    background: white;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideUp 0.3s ease-out;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

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

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

.thanks-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.thanks-header h2 {
    margin: 0;
    font-size: 24px;
}

.close-thanks {
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.close-thanks:hover {
    background: rgba(255, 255, 255, 0.2);
}

.thanks-content {
    padding: 30px;
    text-align: center;
}

.professor-avatar {
    font-size: 80px;
    margin-bottom: 20px;
}

.thanks-text {
    font-size: 18px;
    line-height: 1.6;
    color: #2c3e50;
    margin-bottom: 30px;
    min-height: 200px;
    text-align: left;
}

.thanks-signature {
    border-top: 2px solid #ecf0f1;
    padding-top: 20px;
    color: #7f8c8d;
}

.thanks-signature strong {
    color: #2c3e50;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

/* Seção de Entrada */
.input-section {
    background: #ecf0f1;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.input-section label {
    font-weight: bold;
}

/* Contador de palavras */
.word-counter {
    font-size: 0.9em;
    color: #666;
    font-weight: bold;
    min-width: 80px;
}

.word-counter.warning {
    color: #e67e22;
}

.word-counter.error {
    color: #e74c3c;
}

#message-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    min-width: 200px;
}

button {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

#send-btn {
    background-color: #3498db;
    color: white;
}

#send-btn:hover {
    background-color: #2980b9;
}

#reset-btn {
    background-color: #e74c3c;
    color: white;
}

#reset-btn:hover {
    background-color: #c0392b;
}

.secondary {
    background-color: #95a5a6;
    color: white;
}

.secondary:hover {
    background-color: #7f8c8d;
}

/* Visualização */
.visualization {
    display: flex;
    margin-bottom: 30px;
    gap: 20px;
    min-height: 400px;
}

.osi-layers {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.layer {
    padding: 15px;
    border-bottom: 1px solid #ddd;
    transition: all 0.3s;
    flex: 1;
    display: flex;
    align-items: center;
}

.layer:last-child {
    border-bottom: none;
}

.layer.active {
    background-color: #e8f4fc;
    font-weight: bold;
}

.layer-number {
    background: #34495e;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.layer-content {
    flex: 1;
}

.packet-visual {
    flex: 2;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.packet {
    width: 100%;
    border: 2px solid #3498db;
    border-radius: 5px;
    padding: 10px;
    background: #f9f9f9;
    transition: all 0.3s;
}

.packet-segment {
    margin: 5px 0;
    padding: 8px;
    border-radius: 4px;
    background: #e8f4fc;
    border: 1px dashed #3498db;
}

/* Cores específicas para cada camada OSI */
.layer-7, .packet-segment.layer-7 {
    background-color: #e74c3c !important;
    border-color: #c0392b !important;
    color: white;
}

.layer-6, .packet-segment.layer-6 {
    background-color: #f39c12 !important;
    border-color: #e67e22 !important;
    color: white;
}

.layer-5, .packet-segment.layer-5 {
    background-color: #f1c40f !important;
    border-color: #f39c12 !important;
    color: #2c3e50;
}

.layer-4, .packet-segment.layer-4 {
    background-color: #2ecc71 !important;
    border-color: #27ae60 !important;
    color: white;
}

.layer-3, .packet-segment.layer-3 {
    background-color: #3498db !important;
    border-color: #2980b9 !important;
    color: white;
}

.layer-2, .packet-segment.layer-2 {
    background-color: #9b59b6 !important;
    border-color: #8e44ad !important;
    color: white;
}

.layer-1, .packet-segment.layer-1 {
    background-color: #34495e !important;
    border-color: #2c3e50 !important;
    color: white;
}

/* Cores para as camadas ativas na visualização OSI */
.layer.active.layer-7 {
    background-color: #ffebee !important;
    border-left: 4px solid #e74c3c !important;
}

.layer.active.layer-6 {
    background-color: #fff3e0 !important;
    border-left: 4px solid #f39c12 !important;
}

.layer.active.layer-5 {
    background-color: #fffde7 !important;
    border-left: 4px solid #f1c40f !important;
}

.layer.active.layer-4 {
    background-color: #e8f5e8 !important;
    border-left: 4px solid #2ecc71 !important;
}

.layer.active.layer-3 {
    background-color: #e3f2fd !important;
    border-left: 4px solid #3498db !important;
}

.layer.active.layer-2 {
    background-color: #f3e5f5 !important;
    border-left: 4px solid #9b59b6 !important;
}

.layer.active.layer-1 {
    background-color: #eceff1 !important;
    border-left: 4px solid #34495e !important;
}

/* Estilo para a mensagem final */
.packet-final {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
}

.message-summary {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 5px;
    margin-top: 15px;
}

/* Estilos para o modo desencapsulamento */
.packet-segment.removed {
    background-color: #ffebee !important;
    border-color: #f44336 !important;
    color: #c62828 !important;
    opacity: 0.7;
    text-decoration: line-through;
}

.packet-segment.processing {
    background-color: #fff3e0 !important;
    border-color: #ff9800 !important;
    animation: pulse 1.5s infinite;
}

.packet-segment.final-data {
    background-color: #e8f5e8 !important;
    border-color: #4caf50 !important;
    color: #2e7d32 !important;
    font-weight: bold;
}

.removed-text {
    font-size: 0.9em;
    font-style: italic;
    display: block;
    margin-top: 5px;
}

.original-message {
    background: rgba(76, 175, 80, 0.1);
    padding: 8px;
    border-radius: 4px;
    margin-top: 8px;
    font-family: monospace;
    font-weight: bold;
}

.final-message {
    background: linear-gradient(135deg, #4caf50 0%, #8bc34a 100%);
    color: white;
}

/* Indicador de modo */
.mode-indicator {
    text-align: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #f0f2f5;
    border-radius: 5px;
    border-left: 4px solid #3498db;
}

/* Botão de alternar modo */
.mode-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.mode-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

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

/* Animação de pulso para camada sendo processada */
@keyframes pulse {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.7);
    }
    70% { 
        transform: scale(1.02);
        box-shadow: 0 0 0 10px rgba(255, 152, 0, 0);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 152, 0, 0);
    }
}

/* Controles */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

#step-info {
    font-weight: bold;
    min-width: 100px;
    text-align: center;
}

/* Explicação e Log */
.explanation {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #3498db;
}

.log-container {
    background: #2c3e50;
    color: white;
    padding: 15px;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
}

#process-log {
    font-family: monospace;
    white-space: pre-wrap;
}

/* Seção de Explicações Detalhadas */
.detailed-explanation {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.detailed-explanation h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
    font-size: 20px;
}

.explanation-header {
    margin-bottom: 15px;
}

.explanation-header h4 {
    color: #2c3e50;
    font-size: 18px;
    margin-bottom: 10px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.explanation-body {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    line-height: 1.6;
}

.explanation-body p {
    margin-bottom: 15px;
    color: #34495e;
}

.explanation-body ul {
    margin: 10px 0;
    padding-left: 20px;
}

.explanation-body li {
    margin: 8px 0;
    color: #2c3e50;
}

/* Caixas especiais dentro das explicações */
.what-happens {
    background: #e8f4f8;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #3498db;
}

.what-happens h4 {
    color: #2980b9;
    margin-bottom: 10px;
    font-size: 16px;
}

.technical-detail {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin: 15px 0;
    border-left: 4px solid #6c757d;
    font-family: monospace;
    font-size: 14px;
    color: #495057;
}

.analogy {
    background: #fff3cd;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #ffc107;
    color: #856404;
}

.real-example {
    background: #d4edda;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #28a745;
    color: #155724;
}

.next-step {
    background: #cce5ff;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #007bff;
    color: #004085;
}

.success-message {
    background: #d1ecf1;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #17a2b8;
    color: #0c5460;
}

.learning-complete {
    background: #f8d7da;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

/* Animações */
@keyframes highlight {
    0% { background-color: #fff; }
    50% { background-color: #ffeaa7; }
    100% { background-color: #fff; }
}

.highlight {
    animation: highlight 1s ease;
}

/* Responsividade */
@media (max-width: 1200px) {
    .contacts-sidebar {
        position: relative;
        width: 100%;
        top: auto;
        right: auto;
        margin-bottom: 20px;
        flex-direction: row;
        justify-content: center;
        gap: 20px;
    }
    
    .container {
        flex-direction: column;
    }
    
    .main-content {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .visualization {
        flex-direction: column;
    }
    
    .input-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    #message-input {
        min-width: auto;
    }
    
    .contacts-sidebar {
        gap: 15px;
    }
    
    .contact-card {
        width: 60px;
        height: 60px;
    }
    
    .contact-card .contact-icon {
        font-size: 20px;
    }
    
    .contact-label {
        font-size: 9px;
    }
}

/* Modal de Aviso para Mobile */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
}

.mobile-overlay.hidden {
    display: none;
}

.mobile-modal {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

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

.mobile-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.mobile-modal h2 {
    color: #e74c3c;
    margin-bottom: 20px;
    font-size: 28px;
}

.mobile-modal p {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.6;
}

.mobile-reasons {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: left;
}

.mobile-reasons h3 {
    color: #34495e;
    margin-bottom: 15px;
    text-align: center;
}

.mobile-reasons ul {
    list-style: none;
    padding: 0;
}

.mobile-reasons li {
    margin: 10px 0;
    padding: 8px;
    background: white;
    border-radius: 5px;
    font-size: 14px;
}

.mobile-suggestion {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
}

.mobile-suggestion p {
    color: white;
    margin: 0;
    font-weight: bold;
}

.mobile-btn-secondary {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 15px;
    transition: all 0.3s;
}

.mobile-btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

/* Ocultar modal em telas grandes */
@media (min-width: 769px) {
    .mobile-overlay {
        display: none !important;
    }
}

/* Estilos para usuários mobile que escolheram continuar */
body.mobile-override::before {
    content: "⚠️ Experiência limitada em dispositivo móvel";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #e74c3c;
    color: white;
    text-align: center;
    padding: 5px;
    font-size: 12px;
    font-weight: bold;
    z-index: 1000;
}

body.mobile-override .container {
    margin-top: 30px;
}

/* Ajustes adicionais para mobile override */
@media (max-width: 768px) {
    body.mobile-override .visualization {
        flex-direction: column;
        gap: 10px;
    }
    
    body.mobile-override .osi-layers {
        min-height: 250px;
    }
    
    body.mobile-override .layer {
        padding: 8px;
        font-size: 12px;
    }
    
    body.mobile-override .packet-segment {
        font-size: 11px;
        padding: 6px;
    }
    
    body.mobile-override .controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    body.mobile-override .controls button {
        font-size: 12px;
        padding: 6px 12px;
    }
}