/* 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, #0a0a0a 0%, #1a0a1a 25%, #2a0a2a 50%, #1a0a1a 75%, #0a0a0a 100%);
    min-height: 100vh;
    color: #ffffff;
    overflow-x: hidden;
}

/* Container principale */
.chat-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Schermata login nome */
.name-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: rgba(26, 10, 26, 0.95);
    border: 2px solid rgba(255, 20, 147, 0.4);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    width: 100%;
    backdrop-filter: blur(15px);
    box-shadow: 0 15px 50px rgba(255, 20, 147, 0.3);
}

.login-box h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    background: linear-gradient(45deg, #ff1493, #da70d6, #9370db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-box p {
    color: #dda0dd;
    font-size: 1.1rem;
    margin-bottom: 30px;
    line-height: 1.6;
}

.name-form .input-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.name-input {
    background: rgba(42, 10, 42, 0.8);
    border: 2px solid rgba(255, 20, 147, 0.3);
    border-radius: 15px;
    padding: 18px 20px;
    color: white;
    font-size: 1.1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.name-input::placeholder {
    color: #b19cd9;
}

.name-input:focus {
    outline: none;
    border-color: #ff1493;
    box-shadow: 0 0 25px rgba(255, 20, 147, 0.4);
    background: rgba(42, 10, 42, 0.9);
    transform: scale(1.02);
}

.start-chat-btn {
    background: linear-gradient(135deg, #ff1493, #da70d6);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 18px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.start-chat-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 20, 147, 0.5);
}

.start-chat-btn:active {
    transform: translateY(-1px);
}

.login-info {
    border-top: 1px solid rgba(255, 20, 147, 0.2);
    padding-top: 25px;
}

.login-info p {
    color: #b19cd9;
    font-size: 0.9rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-info i {
    color: #ff1493;
}

/* Schermata chat */
.chat-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, #1a0a1a 0%, #2d1b3d 50%, #4a1f4a 100%);
    border-bottom: 2px solid rgba(255, 20, 147, 0.4);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #ff1493, #da70d6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.user-details {
    color: white;
}

.user-name-display {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.user-status {
    font-size: 14px;
    color: #ff1493;
    opacity: 0.8;
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.change-name-btn, .clear-chat-btn {
    background: linear-gradient(135deg, #ff1493, #da70d6);
    border: none;
    color: white;
    padding: 10px 15px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.change-name-btn:hover, .clear-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 20, 147, 0.4);
}

.clear-chat-btn {
    background: linear-gradient(135deg, #ff4757, #ff3838);
}

.clear-chat-btn:hover {
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.4);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-form {
    background: rgba(26, 10, 26, 0.95);
    border-top: 2px solid rgba(255, 20, 147, 0.4);
    padding: 20px;
    border-radius: 0 0 20px 20px;
}

.input-group {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.input-group textarea {
    flex: 1;
    background: rgba(45, 27, 61, 0.8);
    border: 2px solid rgba(255, 20, 147, 0.3);
    border-radius: 25px;
    padding: 15px 20px;
    color: white;
    font-size: 16px;
    resize: none;
    min-height: 50px;
    max-height: 120px;
    transition: all 0.3s ease;
}

.input-group textarea:focus {
    outline: none;
    border-color: rgba(255, 20, 147, 0.8);
    box-shadow: 0 0 20px rgba(255, 20, 147, 0.3);
}

.send-btn {
    background: linear-gradient(135deg, #ff1493, #da70d6);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(255, 20, 147, 0.5);
}

/* Area messaggi */
.chat-messages {
    flex: 1;
    background: rgba(26, 10, 26, 0.8);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 20px;
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 20, 147, 0.2);
    backdrop-filter: blur(10px);
}

/* Scrollbar personalizzata */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(42, 10, 42, 0.5);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #ff1493, #da70d6);
    border-radius: 3px;
}

/* Messaggi */
.message {
    margin-bottom: 15px;
    animation: fadeInUp 0.3s ease-out;
}

.message-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.message-content i {
    font-size: 1.2rem;
    margin-top: 2px;
    min-width: 20px;
}

.message-text {
    flex: 1;
    word-wrap: break-word;
}

.message-time {
    font-size: 0.7rem;
    color: #b19cd9;
    text-align: right;
    margin-top: 5px;
    margin-right: 30px;
}

/* Tipi di messaggio */
.user-message .message-content i {
    color: #ff1493;
}

.admin-message .message-content i {
    color: #da70d6;
}

.system-message .message-content i {
    color: #9370db;
}

.user-message {
    text-align: right;
}

.user-message .message-content {
    flex-direction: row-reverse;
}

.user-message .message-text {
    background: linear-gradient(135deg, #ff1493, #da70d6);
    padding: 10px 15px;
    border-radius: 18px 18px 4px 18px;
    color: white;
    max-width: 80%;
    margin-left: auto;
}

.admin-message .message-text,
.system-message .message-text {
    background: linear-gradient(135deg, #4a0a4a, #2a0a2a);
    padding: 10px 15px;
    border-radius: 18px 18px 18px 4px;
    border: 1px solid rgba(255, 20, 147, 0.3);
    max-width: 80%;
}

/* Input area */
.chat-input-container {
    background: rgba(26, 10, 26, 0.9);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 20, 147, 0.3);
    backdrop-filter: blur(10px);
}

.chat-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-input {
    background: rgba(42, 10, 42, 0.8);
    border: 1px solid rgba(255, 20, 147, 0.3);
    border-radius: 10px;
    padding: 12px 15px;
    color: white;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    resize: vertical;
    min-height: 80px;
}

.message-input::placeholder {
    color: #b19cd9;
}

.message-input:focus {
    outline: none;
    border-color: #ff1493;
    box-shadow: 0 0 15px rgba(255, 20, 147, 0.3);
    background: rgba(42, 10, 42, 0.9);
}

.send-button {
    background: linear-gradient(135deg, #ff1493, #da70d6);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    align-self: flex-end;
}

.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 20, 147, 0.4);
}

.send-button:active {
    transform: translateY(0);
}

/* Info area */
.chat-info {
    background: rgba(26, 10, 26, 0.7);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    border: 1px solid rgba(255, 20, 147, 0.2);
}

.chat-info p {
    color: #b19cd9;
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.chat-info p:last-child {
    margin-bottom: 0;
}

.chat-info i {
    color: #ff1493;
    margin-right: 5px;
}

/* Animazioni */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive design */
@media (min-width: 768px) {
    .chat-container {
        max-width: 800px;
        padding: 20px;
    }
    
    .login-box {
        padding: 50px;
    }
    
    .login-box h2 {
        font-size: 2.5rem;
    }
    
    .name-form .input-group {
        flex-direction: row;
        align-items: center;
    }
    
    .name-input {
        flex: 1;
        text-align: left;
    }
    
    .start-chat-btn {
        min-width: 180px;
    }
    
    .chat-header h1 {
        font-size: 2.2rem;
    }
    
    .chat-messages {
        max-height: 70vh;
        padding: 20px;
    }
    
    .chat-input-container {
        padding: 25px;
    }
    
    .message-input {
        min-height: 60px;
    }
    
    .send-button {
        padding: 15px 30px;
        font-size: 1.1rem;
    }
}

@media (min-width: 1024px) {
    .chat-container {
        max-width: 1000px;
    }
    
    .chat-messages {
        max-height: 75vh;
    }
}

/* Effetti hover per dispositivi touch */
@media (hover: hover) {
    .start-chat-btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 30px rgba(255, 20, 147, 0.5);
    }
    
    .send-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(255, 20, 147, 0.4);
    }
}

/* Dark mode enhancement */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #000000 0%, #0a0a0a 25%, #1a0a1a 50%, #0a0a0a 75%, #000000 100%);
    }
}

/* Focus visible per accessibilità */
.start-chat-btn:focus-visible,
.send-button:focus-visible,
.name-input:focus-visible,
.message-input:focus-visible {
    outline: 2px solid #ff1493;
    outline-offset: 2px;
}
