:root {
    --primary-dark: #0d1b2a;
    --secondary-dark: #1b263b;
    --accent-blue: #415a77;
    --light-blue: #778da9;
    --light-gray: #e0e1dd;
    --security-green: #4ade80;
    --warning-red: #f87171;
    --crypto-purple: #a78bfa;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Noto Sans', system-ui, sans-serif;
}

body {
    background: radial-gradient(circle at top right, #0f172a, #1e293b);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--light-gray);
    overflow-x: hidden;
}

.security-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="none" stroke="%23374151" stroke-width="0.5"/></svg>');
    opacity: 0.1;
    z-index: -1;
}

.container {
    width: 100%;
    max-width: 800px;
    background: rgba(13, 17, 23, 0.85);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    border: 1px solid rgba(65, 90, 119, 0.3);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

.security-header {
    padding: 20px;
    background: linear-gradient(90deg, var(--primary-dark), var(--secondary-dark));
    border-bottom: 1px solid rgba(119, 141, 169, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.security-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.security-indicators {
    display: flex;
    align-items: center;
    gap: 15px;
}

#security-status {
    font-size: 0.9rem;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 12px;
    border-radius: 20px;
}

.encryption-icon {
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

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

.encrypted-chat {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(10, 15, 20, 0.6);
}

.message {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 18px;
    position: relative;
    word-break: break-word;
    animation: fadeIn 0.3s ease-out;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    line-height: 1.5;
}

.received {
    align-self: flex-start;
    background: linear-gradient(135deg, var(--secondary-dark), var(--accent-blue));
    border-bottom-left-radius: 5px;
    border: 1px solid rgba(119, 141, 169, 0.2);
}

.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, #2e5b8d, #3a7ca5);
    color: white;
    border-bottom-right-radius: 5px;
}

.system {
    align-self: center;
    background: rgba(39, 55, 77, 0.5);
    color: var(--light-gray);
    font-size: 0.85rem;
    padding: 10px 15px;
    border-radius: 10px;
    text-align: center;
    max-width: 90%;
}

.encrypted-tag {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 5px;
    display: block;
    font-family: 'Courier New', monospace;
}

.input-area {
    display: flex;
    padding: 20px;
    background: rgba(15, 23, 42, 0.7);
    border-top: 1px solid rgba(65, 90, 119, 0.2);
    gap: 15px;
}

#message-input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    background: rgba(25, 35, 55, 0.7);
    color: var(--light-gray);
    font-size: 1rem;
    outline: none;
    resize: none;
    min-height: 60px;
    border: 1px solid rgba(65, 90, 119, 0.3);
    transition: border-color 0.3s;
}

#message-input:focus {
    border-color: var(--light-blue);
    box-shadow: 0 0 0 2px rgba(119, 141, 169, 0.3);
}

.encrypted-btn {
    padding: 0 25px;
    background: linear-gradient(135deg, var(--accent-blue), #4a7b9d);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

.encrypted-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

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

.security-footer {
    padding: 15px 20px;
    background: rgba(15, 25, 35, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    border-top: 1px solid rgba(65, 90, 119, 0.1);
}

#connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

#user-id {
    font-weight: 500;
}

.crypto-info {
    font-size: 0.75rem;
    opacity: 0.7;
    font-family: 'Courier New', monospace;
}

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

@media (max-width: 768px) {
    .container {
        border-radius: 12px;
    }
    
    .encrypted-chat {
        height: 50vh;
        padding: 15px;
    }
    
    .input-area {
        flex-direction: column;
    }
    
    .encrypted-btn {
        width: 100%;
        padding: 12px;
    }
    
    .security-footer {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}