/* ===== MODERN SIGNAL MODAL ===== */
/* SmolyanVote цветове */
:root {
    --smolyan-primary: #4cb15c;
    --smolyan-primary-dark: #198754;
    --smolyan-accent: #228e55;
    --smolyan-light: rgba(76, 177, 92, 0.1);
    --smolyan-medium: rgba(76, 177, 92, 0.2);
    --smolyan-border: rgba(76, 177, 92, 0.3);
}

.signal-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.signal-modal.active {
    opacity: 1;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-container {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    position: relative;
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    overflow: visible; /* Променено за three dots menu */
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.signal-modal.active .modal-container {
    transform: scale(1);
}

/* ===== HEADER ===== */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 20px 16px 20px;
    border-bottom: 1px solid #f0f2f5;
    position: relative;
    overflow: visible; /* Важно за three dots menu */
}

.header-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--smolyan-light);
    color: var(--smolyan-primary-dark);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--smolyan-border);
}

.urgency-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.urgency-badge.urgency-HIGH {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.urgency-badge.urgency-MEDIUM {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.urgency-badge.urgency-LOW {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== THREE DOTS MENU ===== */
.dropdown-menu-container {
    position: relative;
    z-index: 15000;
    overflow: visible; /* Важно за показване на menu */
}

.three-dots-btn {
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.three-dots-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.three-dots-menu {
    position: absolute;
    top: calc(100% + 2px);
    right: 0;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    min-width: 160px;
    max-width: 200px;
    z-index: 99999;
    display: none;
    overflow: visible;
    margin: 0;
    padding: 8px 0;
    white-space: nowrap;
}

.three-dots-menu.active {
    display: block !important;
    animation: menuFadeIn 0.15s ease-out forwards;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.menu-item {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    transition: all 0.2s ease;
    line-height: 1.4;
    white-space: nowrap;
}

.menu-item:hover {
    background: #f9fafb !important;
    color: #111827;
}

.menu-item.delete-item {
    color: #dc2626;
}

.menu-item.delete-item:hover {
    background: #fee2e2 !important;
    color: #dc2626;
}

.menu-item i {
    font-size: 14px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.modal-close {
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #e5e7eb;
    color: #374151;
}

/* ===== BODY ===== */
.modal-body {
    padding: 0 20px 20px 20px;
    max-height: calc(85vh - 80px);
    overflow-y: auto;
    overflow-x: visible; /* Важно за three dots menu */
}

/* ===== HERO SECTION ===== */
.hero-section {
    margin-bottom: 20px;
}

.signal-title {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.signal-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.author-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
}

.author-name {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.relative-time {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

/* ===== DESCRIPTION ===== */
.description-section {
    margin-bottom: 20px;
}

.signal-description {
    font-size: 15px;
    line-height: 1.6;
    color: #374151;
    margin: 12px 0;
    background: #f9fafb;
    padding: 10px;
    border-radius: 12px;
    border-left: 1px solid var(--smolyan-primary);
}

/* ===== IMAGE SECTION ===== */
.image-section {
    margin-bottom: 20px;
}

.signal-image-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: #f3f4f6;
}

.signal-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.signal-image-container:hover .signal-image {
    transform: scale(1.05);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.signal-image-container:hover .image-overlay {
    opacity: 1;
}

.image-overlay i {
    color: #ffffff;
    font-size: 24px;
}

/* ===== REACTIONS SECTION ===== */
.reactions-section {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 20px;
}

.reaction-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.reaction-btn {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    transition: all 0.2s ease;
}

.reaction-btn:hover {
    background: #ffffff;
    color: var(--smolyan-primary);
}

.reaction-btn.active {
    color: var(--smolyan-primary);
}

.reaction-btn.active i {
    color: var(--smolyan-primary);
}

.reaction-label {
    font-size: 13px;
    color: #6b7280;
}

/* ===== ACTION SECTION ===== */
.action-section {
    margin-bottom: 20px;
}

.primary-action-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--smolyan-primary), var(--smolyan-primary-dark));
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px var(--smolyan-medium);
}

.primary-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--smolyan-border);
    background: linear-gradient(135deg, var(--smolyan-accent), var(--smolyan-primary-dark));
}

.primary-action-btn:active {
    transform: translateY(0);
}

/* ===== FOOTER ===== */
.modal-footer {
    padding-top: 16px;
    border-top: 1px solid #f0f2f5;
    text-align: center;
}

.detailed-time {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
}

/* ===== IMAGE LIGHTBOX ===== */
.image-lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 100000 !important;
    background: rgba(0, 0, 0, 0.95) !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: 40px !important;
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.image-lightbox.active {
    opacity: 1 !important;
}

.lightbox-container {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

.lightbox-image {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    display: block !important;
    cursor: default;
}

.lightbox-close {
    position: absolute !important;
    top: -60px !important;
    right: 0 !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;
    color: #000000 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 24px !important;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    font-weight: bold;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 1) !important;
    transform: scale(1.1);
}

/* ===== ANIMATIONS ===== */
@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ====== INLINE EDIT STYLES ====== */
.inline-edit-title,
.inline-edit-description {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #4cb15c;
    border-radius: 6px;
    font-size: inherit;
    font-family: inherit;
    color: inherit;
    background: white;
    outline: none;
    box-shadow: 0 0 0 3px rgba(76, 177, 92, 0.1);
    transition: all 0.3s ease;
}

.inline-edit-title {
    font-weight: 700;
    font-size: 1.5rem;
}

.inline-edit-description {
    resize: vertical;
    min-height: 60px;
    line-height: 1.5;
    margin-top: 4px;
}

.editing {
    padding: 4px;
    border-radius: 8px;
    background: rgba(76, 177, 92, 0.05);
}

.edit-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.edit-save-btn,
.edit-cancel-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.edit-save-btn {
    background: #4cb15c;
    color: white;
}

.edit-save-btn:hover:not(:disabled) {
    background: #3a8a47;
    transform: translateY(-1px);
}

.edit-save-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.edit-cancel-btn {
    background: #6c757d;
    color: white;
}

.edit-cancel-btn:hover {
    background: #545b62;
    transform: translateY(-1px);
}

.reaction-btn.liked {
    color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
}

.reaction-btn.liked i {
    color: #dc3545;
}

.reaction-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .modal-container {
        max-width: 95vw;
        max-height: 95vh;
        margin: 10px;
        border-radius: 12px;
    }

    .modal-header,
    .modal-body {
        padding: 16px;
    }

    .signal-title {
        font-size: 18px;
    }

    .header-badges {
        gap: 6px;
    }

    .category-badge,
    .urgency-badge {
        font-size: 12px;
        padding: 5px 10px;
    }

    .reactions-section {
        gap: 16px;
    }
}