/* ===== Login Page ===== */

.logo-login {
  max-width: 500px;
  width: 60%;
  height: auto;
}

.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

/* ==========================================================================
   SHARED PWA DARK THEME — Variabili, reset, stili comuni
   ========================================================================== */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --bg-elevated: #222230;
    --accent-primary: #00d4aa;
    --accent-secondary: #00b894;
    --accent-glow: rgba(0, 212, 170, 0.4);
    --danger: #ff4757;
    --danger-glow: rgba(255, 71, 87, 0.4);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.35);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-accent: rgba(0, 212, 170, 0.3);
}

/* ==========================================================================
   RECEIVER DASHBOARD — /app/receiver
   ========================================================================== */

/* --- Receiver: Reset & Background --- */

.dashboard-bg,
.dashboard-bg *,
.dashboard *,
.call-modal-overlay * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.dashboard-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 212, 170, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(0, 184, 148, 0.05) 0%, transparent 50%),
        linear-gradient(180deg, var(--bg-primary) 0%, #0d0d14 100%);
    pointer-events: none;
    z-index: 0;
}

.dashboard-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

/* --- Receiver: Layout --- */

.dashboard {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
    padding: 24px 20px 100px;
    min-height: 100vh;
    font-family: 'Outfit', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* --- Receiver: Header --- */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.logo-text span {
    color: var(--accent-primary);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-card);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 var(--accent-glow);
        opacity: 1;
    }
    50% {
        box-shadow: 0 0 0 6px transparent;
        opacity: 0.7;
    }
}

/* --- Receiver: Section titles --- */

.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-subtle) 0%, transparent 100%);
}

/* --- Receiver: Intercom/Room cards --- */

.intercoms-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 40px;
}

.intercom-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: card-enter 0.4s ease-out backwards;
}

.intercom-card:hover {
    background: var(--bg-elevated);
    border-color: var(--border-accent);
    transform: translateY(-2px);
}

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

.intercom-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-secondary) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.intercom-info {
    flex: 1;
    min-width: 0;
}

.intercom-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.intercom-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.revoke-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.revoke-btn:hover {
    background: rgba(255, 71, 87, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

/* --- Receiver: Empty state --- */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    background: var(--bg-card);
    border: 1px dashed var(--border-subtle);
    border-radius: 20px;
    margin-bottom: 40px;
}

.empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    background: var(--bg-elevated);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    opacity: 0.5;
}

.empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    max-width: 280px;
    margin: 0 auto;
    line-height: 1.5;
}

/* --- Receiver: Add form --- */

.add-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 24px;
}

.add-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    position: relative;
}

.code-input {
    width: 100%;
    padding: 18px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-subtle);
    border-radius: 14px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem;
    font-weight: 500;
    text-align: center;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.code-input::placeholder {
    color: var(--text-muted);
    letter-spacing: 0.2em;
}

.code-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.input-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}

.submit-btn {
    padding: 18px 24px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border: none;
    border-radius: 14px;
    color: #000;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px var(--accent-glow);
}

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

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.submit-btn .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Receiver: Result message --- */

.result-message {
    padding: 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    display: none;
    align-items: center;
    gap: 12px;
    animation: message-enter 0.3s ease-out;
}

@keyframes message-enter {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
}

.result-message.success {
    display: flex;
    background: rgba(0, 212, 170, 0.1);
    border: 1px solid var(--border-accent);
    color: var(--accent-primary);
}

.result-message.error {
    display: flex;
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

/* --- Receiver: Incoming call modal --- */

.call-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.call-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.call-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: 28px;
    padding: 40px;
    text-align: center;
    max-width: 340px;
    width: 90%;
    transform: scale(0.9) translateY(20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow:
        0 0 60px var(--accent-glow),
        0 25px 50px rgba(0, 0, 0, 0.5);
}

.call-modal-overlay.active .call-modal {
    transform: scale(1) translateY(0);
}

.call-animation {
    width: 100px;
    height: 100px;
    margin: 0 auto 28px;
    position: relative;
}

.call-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
    animation: ring-pulse 1.5s ease-out infinite;
}

.call-ring:nth-child(2) { animation-delay: 0.3s; }
.call-ring:nth-child(3) { animation-delay: 0.6s; }

@keyframes ring-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }
}

.call-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    animation: icon-shake 0.5s ease-in-out infinite;
    box-shadow: 0 4px 30px var(--accent-glow);
}

@keyframes icon-shake {
    0%, 100% { transform: translate(-50%, -50%) rotate(-8deg); }
    50% { transform: translate(-50%, -50%) rotate(8deg); }
}

.call-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.call-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.call-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.call-btn {
    width: 70px;
    height: 70px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    transition: all 0.2s ease;
}

.call-btn:hover {
    transform: scale(1.1);
}

.call-btn.accept {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
}

.call-btn.reject {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 20px var(--danger-glow);
}

/* --- Receiver: Loading skeleton --- */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-elevated) 25%,
        var(--bg-card) 50%,
        var(--bg-elevated) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    height: 88px;
    border-radius: 16px;
    margin-bottom: 12px;
}

/* --- Receiver: Responsive --- */

@media (max-width: 480px) {
    .dashboard {
        padding: 16px 16px 80px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .status-indicator {
        align-self: flex-start;
    }

    .code-input {
        font-size: 1.2rem;
        padding: 16px;
    }

    .call-modal {
        padding: 32px 24px;
    }

    .call-btn {
        width: 60px;
        height: 60px;
        font-size: 1.4rem;
    }
}

/* ==========================================================================
   ROOM CHAT — /app/room/{id}
   ========================================================================== */

/* --- Chat: Layout wrapper (sostituisce body flex) --- */

.chat-layout {
    font-family: 'Outfit', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
}

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

/* --- Chat: Background --- */

.chat-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 212, 170, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(0, 184, 148, 0.05) 0%, transparent 50%),
        linear-gradient(180deg, var(--bg-primary) 0%, #0d0d14 100%);
    pointer-events: none;
    z-index: 0;
}

/* --- Chat: Header --- */

.chat-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.chat-back-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.3rem;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.chat-back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.chat-header-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 2px 12px var(--accent-glow);
    flex-shrink: 0;
}

.chat-header-info {
    flex: 1;
    min-width: 0;
}

.chat-header-name {
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chat-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.header-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.header-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-accent);
    color: var(--accent-primary);
}

.header-btn.active {
    background: rgba(0, 212, 170, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* --- Chat: Messages area --- */

.chat-messages {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 2px;
}

/* --- Chat: Message bubbles --- */

.message {
    max-width: 85%;
    animation: msg-enter 0.2s ease-out;
}

@keyframes msg-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

.message.own {
    align-self: flex-end;
}

.message.other {
    align-self: flex-start;
}

.message-sender {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 4px;
    padding-left: 12px;
}

.message.own .message-sender {
    text-align: right;
    padding-right: 12px;
    padding-left: 0;
}

.message-bubble {
    padding: 10px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.own .message-bubble {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: #000;
    border-bottom-right-radius: 4px;
}

.message.other .message-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 12px;
}

.message.own .message-time {
    text-align: right;
}

.message-pending {
    opacity: 0.7;
}

.message-pending-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.pending-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 3px;
}

.pending-action-btn {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: opacity 0.2s;
}

.pending-action-btn:hover {
    opacity: 0.8;
}

.pending-action-btn.retry-btn {
    background: rgba(0, 212, 170, 0.2);
    color: var(--accent-primary);
}

.pending-action-btn.cancel-btn {
    background: rgba(255, 71, 87, 0.15);
    color: var(--danger);
}

/* --- Chat: System messages --- */

.system-message {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 8px 0;
}

/* --- Chat: Empty state --- */

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--text-muted);
}

.chat-empty-icon {
    width: 72px;
    height: 72px;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    opacity: 0.5;
}

/* --- Chat: Input area --- */

.chat-input-area {
    position: relative;
    z-index: 2;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    max-width: 600px;
    margin: 0 auto;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    resize: none;
    max-height: 120px;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-input:focus {
    border-color: var(--accent-primary);
}

.send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border: none;
    border-radius: 50%;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.send-btn:hover {
    transform: scale(1.05);
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* --- Chat: Offline banner --- */

.offline-banner {
    display: none;
    padding: 8px 16px;
    background: rgba(255, 71, 87, 0.15);
    border-bottom: 1px solid var(--danger);
    text-align: center;
    font-size: 0.8rem;
    color: var(--danger);
    z-index: 2;
    position: relative;
}

.offline-banner.visible {
    display: block;
}

/* --- Chat: Name modal --- */

.name-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.name-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: 24px;
    padding: 40px 32px;
    text-align: center;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 0 60px var(--accent-glow);
}

.name-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.name-modal h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.name-modal p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.name-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-subtle);
    border-radius: 14px;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    text-align: center;
    transition: all 0.2s ease;
    margin-bottom: 16px;
}

.name-input::placeholder {
    color: var(--text-muted);
}

.name-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.name-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border: none;
    border-radius: 14px;
    color: #000;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.name-submit-btn:hover {
    transform: translateY(-2px);
}

/* --- Chat: Favorite button --- */

.fav-btn {
    font-size: 0.75rem;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.fav-btn:hover {
    border-color: var(--border-accent);
    color: var(--accent-primary);
}

.fav-btn.is-fav {
    background: rgba(0, 212, 170, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* --- Chat: Message images --- */

.message-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    display: block;
    object-fit: cover;
}

.message.own .message-image {
    border-radius: 10px;
}

/* --- Chat: Photo button --- */

.photo-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.photo-btn:hover {
    border-color: var(--border-accent);
    color: var(--accent-primary);
}

/* --- Chat: Photo preview --- */

.photo-preview {
    display: none;
    padding: 8px 16px 0;
    position: relative;
    z-index: 2;
    background: var(--bg-secondary);
}

.photo-preview.visible {
    display: block;
}

.photo-preview-inner {
    position: relative;
    display: inline-block;
}

.photo-preview img {
    max-height: 120px;
    max-width: 200px;
    border-radius: 10px;
    object-fit: cover;
}

.photo-preview-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--danger);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Chat: Fullscreen image viewer --- */

.image-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.image-fullscreen.active {
    display: flex;
}

.image-fullscreen img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 8px;
}

/* --- Chat: Sending indicator --- */

.sending-photo {
    opacity: 0.6;
}

.sending-photo .message-bubble::after {
    content: ' (invio foto...)';
    font-size: 0.75rem;
    font-style: italic;
}

/* --- Chat: Responsive --- */

@media (max-width: 480px) {
    .chat-header {
        padding: 12px 16px;
    }
    .chat-messages {
        padding: 16px 12px;
    }
    .message {
        max-width: 90%;
    }
}
