@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800&display=swap');

@import url('./styles/base.css');
@import url('./styles/layout.css');
@import url('./styles/messages.css');
@import url('./styles/components.css');
@import url('./styles/input.css');
@import url('./styles/modals.css');

* {
    font-family: 'JetBrains Mono', monospace !important;
}

body {
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-screen.hidden {
    display: none;
}

.loading-circle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-circle svg {
    width: 80px;
    height: 80px;
    transform: rotate(-90deg); /* Починаємо з верху */
}

.security-message-content {
    background: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%);
    border: 1px solid var(--danger-color);
    border-radius: 12px;
    padding: 6px 10px; 
    margin: 2px 0; 
    display: flex;
    align-items: center;
    gap: 6px; 
    box-shadow: 0 1px 4px rgba(220, 53, 69, 0.15); 
    animation: securityMessageSlideIn 0.3s ease-out;
    max-width: min(60vw, 400px); 
    width: auto;
    font-size: 13px; 
    line-height: 1.3;
}

.security-message-content .security-icon {
    color: #dc3545;
    font-size: 12px; 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 12px; 
    height: 12px;
}

.security-message-content .security-icon svg {
    width: 12px !important; 
    height: 12px !important;
    display: block;
}

.security-message-content .security-text {
    color: #e9ecef;
    font-size: 13px; 
    line-height: 1.3;
    font-weight: 400; 
    flex: 1;
}

.message.security-warning .message-avatar {
    display: flex !important;
    background: #888 !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    color: white !important;
    font-weight: bold !important;
    left: 8px !important;
    bottom: 0 !important;
    position: absolute !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    z-index: 5 !important;
}

@media (max-width: 1199px) {
    .message.security-warning .message-avatar {
        display: none !important;
    }
    
    .message.security-warning {
        padding-left: 12px !important;
    }
}

@media (min-width: 1200px) {
    .message.security-warning .message-avatar {
        display: flex !important;
    }
    
    .message.security-warning {
        justify-content: flex-start !important;
        padding-left: 52px !important;
        padding-right: 12px !important;
        margin-bottom: 8px;
    }
}

@keyframes securityMessageSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.security-warning .security-message-content strong {
    color: var(--danger-color);
    font-weight: 600;
}

.link-previews-container {
    margin-top: 8px;
}

.link-preview {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 100%;
    word-break: break-word;
}

.link-preview:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: scale(1.02);
    border-color: rgba(255, 255, 255, 0.2);
}

.link-preview-image {
    width: 100%;
    height: 150px;
    overflow: hidden;
    position: relative;
}

.link-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.link-preview:hover .link-preview-image img {
    transform: scale(1.05);
}

.link-preview-content {
    padding: 8px 10px;
    overflow: hidden;
}

.link-preview-title {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 4px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
    word-break: break-word;
}

.link-preview-description {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.3;
    word-break: break-word;
}

.link-preview-url {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    word-break: break-all;
}

.message-reply-to {
    background-color: rgba(255, 255, 255, 0.1);
    border-left: 3px solid rgba(255, 255, 255, 0.4);
    padding: 6px 8px;
    margin-bottom: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.message-reply-to:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateX(2px);
}

.reply-author {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2px;
}

.reply-preview {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 100%;
}

.message-content.emoji-only {
    font-size: 48px;
    padding: 8px 0;
    line-height: 1.2;
}

.message.outgoing .message-content.emoji-only {
    text-align: right;
}

.message.incoming .message-content.emoji-only {
    text-align: left;
}

.message.emoji-only-message {
    margin: 4px 0;
    /* padding успадковується від .message - однакові відступи */
    align-items: center;
}

.message.emoji-only-message.outgoing {
    justify-content: flex-end;
}

.message.emoji-only-message.incoming {
    justify-content: flex-start;
}

.message.emoji-only-message .message-bubble {
    display: none;
}


/* Emoji reply messages */
.message.reply-emoji-only {
    flex-direction: column;
    align-items: flex-end;
    margin: 8px 0;
}

.message.reply-emoji-only.incoming {
    align-items: flex-start;
}

.reply-header-emoji {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 6px 12px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 250px;
    cursor: pointer;
}

.message-content.emoji-reply {
    font-size: 40px;
    margin: 0;
}

.message.highlighted .message-bubble {
    background-color: rgba(104, 163, 212, 0.2) !important;
    animation: highlightFade 2s ease-in-out;
}

@keyframes highlightFade {
    0% { background-color: rgba(104, 163, 212, 0.4) !important; }
    100% { background-color: rgba(104, 163, 212, 0.1) !important; }
}

.message-bubble.loading {
    opacity: 0.7;
    pointer-events: none;
}

.message-bubble.error {
    border: 1px solid #f44336;
    background-color: rgba(244, 67, 54, 0.1) !important;
}

.message-reaction:focus,
.link-preview:focus,
.message-reply-to:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

.message-content::selection {
    background-color: rgba(104, 163, 212, 0.3);
    color: white;
}

.auto-delete-option {
    padding: 12px 16px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin: 8px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auto-delete-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.auto-delete-checkbox input[type="checkbox"] {
    display: none;
}

.auto-delete-checkbox .checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background-color: transparent;
    position: relative;
    transition: all 0.2s ease;
}

.auto-delete-checkbox input[type="checkbox"]:checked + .checkmark {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.auto-delete-checkbox input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -50%) rotate(45deg);
}

.auto-delete-checkbox:hover .checkmark {
    border-color: rgba(255, 255, 255, 0.5);
}

.auto-delete-checkbox input[type="checkbox"]:checked:hover + .checkmark {
    background-color: #4a9eff;
}

.auto-delete-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
}

.message.deleting {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease-out;
}

.message.deleting .message-bubble {
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
}

/* Connecting State */
.connecting-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 24px;
    margin: 16px 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    font-weight: 500;
}

.connecting-state.hidden {
    display: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Unified Modal Button Styles */
.allow-btn,
.connect-btn,
.btn-primary {
    padding: 12px 24px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.allow-btn:hover,
.connect-btn:hover,
.btn-primary:hover {
    background: rgba(0, 123, 255, 0.8);
    transform: translateY(-2px);
}

.deny-btn,
.cancel-btn,
.btn-secondary {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.deny-btn:hover,
.cancel-btn:hover,
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.delete-btn {
    padding: 12px 24px;
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.5);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-btn:hover {
    background: rgba(220, 53, 69, 0.3);
    transform: translateY(-2px);
}

/* Donation Modal Styles */
/* Connection lost blur */
.connection-lost-blur {
    filter: blur(8px);
    pointer-events: none;
}

/* Connection Restore Modal */
.restore-message {
    text-align: center;
    margin-bottom: 24px;
}

.restore-message h3 {
    font-size: 20px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    margin: 0 0 12px 0;
}

.restore-message p {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.85);
    margin: 8px 0;
}

.restore-note {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.65);
    font-style: italic;
}

.restore-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.restore-buttons .btn-primary,
.restore-buttons .btn-secondary {
    flex: 1;
    max-width: 150px;
}

/* App intro in connection modal */
.app-intro {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-logo {
    width: 60px;
    height: 60px;
    margin-bottom: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    background: white;
    padding: 4px;
}

.app-intro h2 {
    font-size: 20px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    margin: 0 0 8px 0;
}

.app-tagline {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    margin: 8px 0;
}

.app-features {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.6;
    margin: 8px 0 0 0;
}

.support-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    margin-top: 12px;
}

.donation-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.payment-buttons-row {
    display: flex;
    gap: 10px;
}

.donate-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.donate-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.maybe-later-btn {
    padding: 10px 24px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.maybe-later-btn:hover {
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

/* Code Label Row */
.code-label-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.code-label-row p {
    margin: 0;
}

/* Generate Code Button Styles */
.generate-code-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--accent-blue);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    flex-shrink: 0;
}

.generate-code-btn svg {
    width: 20px;
    height: 20px;
}

.generate-code-btn:hover {
    background: #4a9eff;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(104, 163, 212, 0.4);
}

.generate-code-btn:active {
    transform: scale(0.95);
}

.user-code-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-code-section.hidden {
    display: none;
}


/* Copy/Share Button Styles */
.copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.8);
    padding: 0;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-btn svg {
    width: 16px;
    height: 16px;
}

