/* ═══════════════════════════════════════════════════
   Safe Message — Premium Dark Glassmorphism Theme
   ═══════════════════════════════════════════════════ */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(20, 20, 35, 0.7);
    --bg-card-solid: #14142380;
    --bg-input: rgba(30, 30, 50, 0.6);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(99, 102, 241, 0.3);
    --text-primary: #f0f0f5;
    --text-secondary: #8888a8;
    --text-muted: #555570;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.3);
    --success: #10b981;
    --warning: #f59e0b;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Anti-Screenshot Protection ──────────────────── */

.protected-content {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Hide everything when printing / print-screen on some browsers */
@media print {
    body * {
        display: none !important;
    }
    body::after {
        content: '🔒 Content is protected — cannot be printed.';
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: fixed;
        inset: 0;
        background: #000;
        color: #333;
        font-size: 24px;
        font-family: var(--font);
        z-index: 999999;
    }
}

.screenshot-guard {
    position: fixed;
    inset: 0;
    z-index: 999998;
    pointer-events: none;
    /* This creates a protected layer that shows black in many screenshot tools */
    mix-blend-mode: difference;
}

.blur-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.97);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.blur-overlay .blur-message {
    text-align: center;
    color: var(--text-secondary);
}

.blur-overlay .blur-message svg {
    margin-bottom: 16px;
    color: var(--accent-primary);
}

.blur-overlay .blur-message p {
    font-size: 18px;
    font-weight: 500;
}

/* ─── Background Animation ────────────────────────── */

.bg-animation {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-primary);
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 350px;
    height: 350px;
    background: var(--accent-secondary);
    bottom: -50px;
    left: -50px;
    animation-delay: -7s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: #ec4899;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(40px, -40px) scale(1.1); }
    50% { transform: translate(-20px, 30px) scale(0.95); }
    75% { transform: translate(30px, 20px) scale(1.05); }
}

/* ─── Layout ──────────────────────────────────────── */

.container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* ─── Landing Card ────────────────────────────────── */

.landing-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
}

.logo-icon {
    width: 64px;
    height: 64px;
    background: var(--accent-gradient);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    animation: pulse-glow 3s ease-in-out infinite;
}

.logo-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

.logo h1 {
    font-size: 28px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.tagline {
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 32px;
    line-height: 1.5;
}

/* ─── Features ────────────────────────────────────── */

.features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 32px;
}

.feature {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: var(--transition);
}

.feature:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.feature-text strong {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.feature-text span {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ─── Buttons ─────────────────────────────────────── */

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}

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

.btn-secondary {
    width: 100%;
    padding: 12px 24px;
    background: var(--bg-input);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-md);
    color: var(--accent-primary);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
}

.btn-secondary:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.btn-danger {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: var(--danger);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font);
    font-size: 13px;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 16px var(--danger-glow);
}

.btn-copy {
    padding: 10px 14px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.btn-copy:hover {
    opacity: 0.9;
}

/* ─── Room Result ─────────────────────────────────── */

.room-result {
    margin-top: 24px;
    animation: slideUp 0.4s ease;
}

.room-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.room-link-box {
    display: flex;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-glow);
}

.room-link-box input {
    flex: 1;
    padding: 12px 14px;
    background: var(--bg-input);
    border: none;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
    outline: none;
}

.room-actions {
    margin-top: 12px;
}

.copy-notice {
    margin-top: 8px;
    font-size: 12px;
    color: var(--success);
    text-align: center;
    animation: fadeIn 0.3s ease;
}

/* ─── Modal ───────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-icon {
    width: 72px;
    height: 72px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--accent-primary);
}

.modal-icon.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.modal-card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

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

.modal-card input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 15px;
    outline: none;
    transition: var(--transition);
    margin-bottom: 16px;
}

.modal-card input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

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

/* ─── Chat Interface ──────────────────────────────── */

.chat-interface {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    z-index: 10;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.back-btn:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.room-info h2 {
    font-size: 16px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.online-badge {
    font-size: 11px;
    color: var(--success);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.online-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    display: inline-block;
    animation: blink 2s ease-in-out infinite;
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.room-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    padding: 6px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

/* ─── Chat Messages ───────────────────────────────── */

.chat-messages {
    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(--text-muted);
    border-radius: 4px;
}

.chat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.shield-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.chat-welcome p {
    font-size: 15px;
    font-weight: 500;
}

.chat-welcome .small {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
}

.chat-welcome .hint-hold {
    margin-top: 16px;
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    display: inline-block;
}

/* ─── Message Bubble ──────────────────────────────── */

.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: messageIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

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

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

.message-username {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 4px;
    padding: 0 4px;
}

.message.own .message-username {
    text-align: right;
    color: var(--accent-secondary);
}

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: transform 0.1s ease;
}

.message-bubble:active {
    transform: scale(0.98);
}

.message-text {
    -webkit-filter: blur(6px);
    filter: blur(6px);
    transition: filter 0.2s ease, -webkit-filter 0.2s ease;
    opacity: 0.8;
}

.message-bubble.revealed .message-text {
    -webkit-filter: blur(0);
    filter: blur(0);
    opacity: 1;
}

.message.own .message-bubble {
    background: var(--accent-gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

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

.message-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
    padding: 0 4px;
}

.message-time {
    font-size: 10px;
    color: var(--text-muted);
}

.message-timer {
    font-size: 10px;
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: 3px;
    font-weight: 500;
}

.message-timer-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    transition: width 1s linear;
}

/* Message fade out */
.message.expiring {
    animation: messageExpire 1s ease forwards;
}

/* ─── System Message ──────────────────────────────── */

.system-message {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 16px;
    animation: fadeIn 0.3s ease;
}

.system-message span {
    background: var(--bg-input);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

/* ─── Typing Indicator ────────────────────────────── */

.typing-indicator {
    padding: 8px 20px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 5px;
    height: 5px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ─── Chat Input ──────────────────────────────────── */

.chat-input-area {
    padding: 16px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
}

.input-wrapper {
    display: flex;
    gap: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

#messageInput {
    flex: 1;
    padding: 14px 16px;
    background: var(--bg-input);
    border: none;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    outline: none;
}

#messageInput::placeholder {
    color: var(--text-muted);
}

.btn-send {
    padding: 14px 18px;
    background: var(--accent-gradient);
    border: none;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.btn-send:hover {
    opacity: 0.9;
}

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

/* ─── Footer ──────────────────────────────────────── */

.footer {
    margin-top: 24px;
    text-align: center;
}

.footer p {
    font-size: 12px;
    color: var(--text-muted);
}

/* ─── Utility Classes ─────────────────────────────── */

.hidden {
    display: none !important;
}

/* ─── Animations ──────────────────────────────────── */

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

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

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

@keyframes messageExpire {
    0% {
        opacity: 1;
        transform: scale(1);
        max-height: 200px;
    }
    50% {
        opacity: 0.3;
        transform: scale(0.98);
    }
    100% {
        opacity: 0;
        transform: scale(0.95) translateX(20px);
        max-height: 0;
        padding: 0;
        margin: 0;
        overflow: hidden;
    }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 4px 30px rgba(99, 102, 241, 0.6); }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* ─── Responsive ──────────────────────────────────── */

@media (max-width: 600px) {
    .landing-card {
        padding: 32px 24px;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .message {
        max-width: 90%;
    }

    .chat-header {
        padding: 10px 14px;
    }

    .room-timer {
        display: none;
    }
}

/* ─── Confirm Dialog ──────────────────────────────── */

.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.2s ease;
}

.confirm-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.confirm-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
}

.confirm-actions button {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.confirm-cancel {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.confirm-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
}

.confirm-delete {
    background: var(--danger);
    border: none;
    color: white;
}

.confirm-delete:hover {
    opacity: 0.9;
}
