/*
 * File: sparks-area.css
 * Desc: Constellation-style notification system (Sparks Area)
 *       Designed for easy metaphor swapping (constellation → stack/deck → etc.)
 */

/* ============================================================================
   Container
   ============================================================================ */

.sparks-area {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    padding: 16px;
    color: var(--white);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    margin-top: auto;
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.sparks-header {
    margin-bottom: 12px;
}

.sparks-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #8B7EC8, #7FB069);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sparks-subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

/* ============================================================================
   Constellation Container
   ============================================================================ */

.constellation-container {
    position: relative;
    width: 100%;
    height: 200px;
    margin: 8px 0;
    border-radius: 8px;
    overflow: hidden;
    background: radial-gradient(ellipse at center, #0f3460 0%, #0a1929 100%);
    /* Stars are positioned with boundary checking to stay within visible area */
}

#starCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.star-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ============================================================================
   Stars
   ============================================================================ */

.star {
    position: absolute;
    cursor: pointer;
    pointer-events: all;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: all 0.3s ease;
}

.star-visible {
    opacity: 1;
}

.star:hover {
    transform: translate(-50%, -50%) scale(1.3);
    filter: drop-shadow(0 0 8px currentColor);
}

.star-icon {
    font-size: 1.5rem;
    display: block;
    animation: starGlow 2s ease-in-out infinite;
}

/* Star types with different colors and behaviors */

.star-lex .star-icon {
    color: #8B7EC8;
    animation: starTwinkle 3s ease-in-out infinite;
}

.star-campaign .star-icon {
    color: #7FB069;
    animation: starGlow 2s ease-in-out infinite;
}

.star-system .star-icon {
    color: #FFC107;
    animation: starPulse 1.5s ease-in-out infinite;
}

/* ============================================================================
   Star Animations
   ============================================================================ */

@keyframes starTwinkle {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.9);
    }
}

@keyframes starGlow {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.3);
    }
}

@keyframes starPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

.star.twinkle .star-icon {
    animation: quickTwinkle 0.5s ease-in-out;
}

@keyframes quickTwinkle {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
        transform: scale(1.2);
    }
}

/* ============================================================================
   Star Tooltip Overlay (Cloud Bubble to the Right)
   ============================================================================ */

.sparks-tooltip-overlay {
    position: fixed;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.sparks-tooltip-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sparks-tooltip-content {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.98), rgba(22, 33, 62, 0.98));
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 20px 24px;
    min-width: 280px;
    max-width: 350px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(139, 126, 200, 0.3),
        0 0 20px rgba(139, 126, 200, 0.1);
    position: relative;
}

/* Cloud bubble pointer (arrow pointing left toward the Sparks Area) */
.sparks-tooltip-content::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 30px;
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-right: 12px solid rgba(139, 126, 200, 0.3);
}

.sparks-tooltip-content::after {
    content: '';
    position: absolute;
    left: -8px;
    top: 32px;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 10px solid rgba(26, 26, 46, 0.98);
}

.sparks-tooltip-title {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--white);
    line-height: 1.3;
}

.sparks-tooltip-message {
    margin: 0 0 12px 0;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
}

.sparks-tooltip-time {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* Type-specific colors for tooltip titles */
.sparks-tooltip-overlay.sparks-tooltip-lex .sparks-tooltip-title {
    color: #8B7EC8;
}

.sparks-tooltip-overlay.sparks-tooltip-lex .sparks-tooltip-content {
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(139, 126, 200, 0.4),
        0 0 20px rgba(139, 126, 200, 0.2);
}

.sparks-tooltip-overlay.sparks-tooltip-campaign .sparks-tooltip-title {
    color: #7FB069;
}

.sparks-tooltip-overlay.sparks-tooltip-campaign .sparks-tooltip-content {
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(127, 176, 105, 0.4),
        0 0 20px rgba(127, 176, 105, 0.2);
}

.sparks-tooltip-overlay.sparks-tooltip-campaign .sparks-tooltip-content::before {
    border-right-color: rgba(127, 176, 105, 0.3);
}

.sparks-tooltip-overlay.sparks-tooltip-system .sparks-tooltip-title {
    color: #FFC107;
}

.sparks-tooltip-overlay.sparks-tooltip-system .sparks-tooltip-content {
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 193, 7, 0.4),
        0 0 20px rgba(255, 193, 7, 0.2);
}

.sparks-tooltip-overlay.sparks-tooltip-system .sparks-tooltip-content::before {
    border-right-color: rgba(255, 193, 7, 0.3);
}

/* ============================================================================
   Summary Area
   ============================================================================ */

.sparks-summary {
    margin: 8px 0;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.summary-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
}

.empty-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.6;
}

.summary-empty p {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.empty-subtitle {
    font-size: 0.75rem;
    opacity: 0.7;
}

.summary-active {
    text-align: center;
    width: 100%;
}

.summary-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin-bottom: 6px;
}

.summary-lex {
    color: #8B7EC8;
    font-weight: 600;
    font-size: 0.85rem;
}

.summary-campaign {
    color: #7FB069;
    font-weight: 600;
    font-size: 0.85rem;
}

.summary-system {
    color: #FFC107;
    font-weight: 600;
    font-size: 0.85rem;
}

.summary-divider {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.7rem;
}

.summary-hint {
    margin: 0;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* ============================================================================
   Explore Button
   ============================================================================ */

.sparks-explore-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, rgba(139, 126, 200, 0.2), rgba(127, 176, 105, 0.2));
    border: 1px solid rgba(139, 126, 200, 0.4);
    border-radius: 8px;
    color: var(--white);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
}

.sparks-explore-btn:hover {
    background: linear-gradient(135deg, rgba(139, 126, 200, 0.3), rgba(127, 176, 105, 0.3));
    border-color: rgba(139, 126, 200, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 126, 200, 0.3);
}

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

.btn-icon {
    font-size: 1.2rem;
}

.btn-text {
    font-size: 0.9rem;
}

/* ============================================================================
   Modal - Explore Sky View
   ============================================================================ */

.sparks-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sparks-modal.active {
    opacity: 1;
}

.sparks-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.sparks-modal-content {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.sparks-modal.active .sparks-modal-content {
    transform: scale(1);
}

.sparks-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    background: linear-gradient(135deg, rgba(139, 126, 200, 0.2), rgba(127, 176, 105, 0.2));
    border-bottom: 1px solid rgba(139, 126, 200, 0.3);
}

.sparks-modal-header h2 {
    margin: 0;
    color: var(--white);
    font-size: 1.5rem;
}

.sparks-modal-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 4px;
    transition: background 0.2s;
}

.sparks-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sparks-modal-body {
    padding: 24px;
    max-height: calc(80vh - 100px);
    overflow-y: auto;
}

/* Modal Empty State */

.modal-empty {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.modal-empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.6;
}

.modal-empty h3 {
    color: var(--white);
    margin: 0 0 8px 0;
}

.modal-empty p {
    margin: 0;
    font-size: 0.9rem;
}

/* Modal Sections */

.modal-section {
    margin-bottom: 32px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section-title {
    color: var(--white);
    font-size: 1.1rem;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(139, 126, 200, 0.3);
}

/* Notification Cards */

.notification-card {
    background: rgba(26, 26, 46, 0.6);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.notification-card:hover {
    background: rgba(26, 26, 46, 0.8);
    transform: translateX(4px);
}

.notification-lex {
    border-left-color: #8B7EC8;
}

.notification-campaign {
    border-left-color: #7FB069;
}

.notification-system {
    border-left-color: #FFC107;
}

.notification-content h4 {
    margin: 0 0 8px 0;
    color: var(--white);
    font-size: 1rem;
}

.notification-content p {
    margin: 0 0 8px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    line-height: 1.5;
}

.notification-time {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.notification-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.notification-action-view,
.notification-action-dismiss {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.notification-action-view {
    background: linear-gradient(135deg, #8B7EC8, #7FB069);
    color: var(--white);
}

.notification-action-view:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(139, 126, 200, 0.4);
}

.notification-action-dismiss {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.notification-action-dismiss:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 768px) {
    .sparks-area {
        min-height: 250px;
    }

    .constellation-container {
        height: 150px;
    }

    .sparks-tooltip-content {
        min-width: 200px;
        max-width: 250px;
        padding: 16px 18px;
        font-size: 0.85rem;
    }

    .sparks-tooltip-title {
        font-size: 0.9rem;
    }

    .sparks-tooltip-message {
        font-size: 0.8rem;
    }

    .sparks-modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .sparks-modal-header {
        padding: 16px;
    }

    .sparks-modal-body {
        padding: 16px;
    }
}

/* ============================================================================
   Accessibility
   ============================================================================ */

.star:focus {
    outline: 2px solid #8B7EC8;
    outline-offset: 4px;
}

.sparks-explore-btn:focus {
    outline: 2px solid #8B7EC8;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .star,
    .star-icon,
    .sparks-explore-btn,
    .sparks-modal,
    .sparks-modal-content {
        animation: none;
        transition: none;
    }
}
