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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 30px rgba(0,0,0,0.15);
}

header {
    background: #075e54;
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

#disconnectBtn {
    background: #128c7e;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.3s;
}

#disconnectBtn:hover {
    background: #0f7a6f;
}

.screen {
    padding: 2rem;
}

.setup-container {
    max-width: 700px;
    margin: 0 auto;
}

.setup-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #075e54;
    font-size: 1.8rem;
}

.setup-section {
    margin-bottom: 2rem;
    padding: 2rem;
    border: 1px solid #e0e0e0;
    border-radius: 15px;
    background: #fafafa;
    transition: box-shadow 0.3s;
}

.setup-section:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.setup-section h3 {
    margin-bottom: 1rem;
    color: #075e54;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-text {
    margin-bottom: 1rem;
    color: #666;
    font-size: 0.9rem;
}

input, textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: border-color 0.3s;
    font-family: inherit;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #075e54;
}

textarea {
    height: 120px;
    resize: vertical;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
}

button {
    background: #075e54;
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s;
}

button:hover {
    background: #128c7e;
    transform: translateY(-1px);
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.key-display {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

.key-display textarea, .key-display input {
    margin-bottom: 1rem;
    background: #f8f9fa;
}

.status-message {
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.chat-options {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
}

.option-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    text-align: center;
    transition: all 0.3s;
}

.option-card:hover {
    border-color: #075e54;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.option-card h4 {
    margin-bottom: 0.5rem;
    color: #075e54;
}

.option-card p {
    margin-bottom: 1rem;
    color: #666;
    font-size: 0.9rem;
}

.option-divider {
    font-weight: bold;
    color: #666;
    text-align: center;
}

/* Chat Screen Styles */
#chatScreen {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
}

.chat-header {
    background: #075e54;
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.contact-info {
    display: flex;
    flex-direction: column;
}

.contact-info span:first-child {
    font-size: 1.2rem;
    font-weight: 600;
}

.encryption-status {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

.chat-id-display {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

.connection-status {
    background: #128c7e;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: #e5ddd5;
}

.welcome-message {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.welcome-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.welcome-message h3 {
    margin-bottom: 0.5rem;
    color: #075e54;
}

.message {
    margin-bottom: 1rem;
    display: flex;
    animation: messageSlide 0.3s ease-out;
}

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

.message.sent {
    justify-content: flex-end;
}

.message.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.message.sent .message-bubble {
    background: #dcf8c6;
    border-bottom-right-radius: 5px;
}

.message.received .message-bubble {
    background: white;
    border-bottom-left-radius: 5px;
}

.message-content {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.message-time {
    font-size: 0.7rem;
    color: #666;
    text-align: right;
}

.message-sender {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.message-input {
    display: flex;
    padding: 1.5rem;
    background: #f0f0f0;
    gap: 1rem;
    border-top: 1px solid #e0e0e0;
}

.message-input input {
    flex: 1;
    margin-bottom: 0;
    padding: 1rem 1.25rem;
    border-radius: 25px;
    border: 1px solid #ddd;
}

.message-input button {
    margin: 0;
    border-radius: 25px;
    padding: 1rem 1.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        margin: 0;
        border-radius: 0;
    }
    
    .setup-section {
        margin: 1rem 0;
        padding: 1.5rem;
        border-radius: 10px;
    }
    
    .chat-options {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .option-divider {
        order: -1;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .chat-header {
        padding: 1rem;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group button {
        margin-right: 0;
    }
}
