/* word-explainer.css - Frontend styles */

/* Forklarbare ord */
.explainable-word {
    background: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%);
    color: #2c3e50;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 2px dotted #3498db;
    transition: all 0.3s ease;
    position: relative;
    display: inline;
}

.explainable-word:hover {
    background: linear-gradient(120deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    text-decoration: none;
}

.explainable-word:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Popup styles */
.word-explanation-popup {
    position: absolute;
    background: white;
    border: 2px solid #3498db;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    z-index: 999999;
    max-width: 320px;
    min-width: 200px;
    font-size: 14px;
    display: none;
    animation: fadeIn 0.3s ease;
}

.word-explanation-popup::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid #3498db;
}

.word-explanation-popup::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 22px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
}

.word-explanation-popup h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    padding-right: 25px; /* Plass til lukkeknapp */
}

.word-explanation-popup p {
    margin: 0;
    color: #555;
    line-height: 1.5;
}

.word-explanation-popup .close-btn {
    position: absolute;
    top: 5px;
    right: 8px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.word-explanation-popup .close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.word-explanation-popup .close-btn:focus {
    outline: 2px solid #0073aa;
}

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

/* Responsiv design */
@media (max-width: 480px) {
    .word-explanation-popup {
        max-width: calc(100vw - 20px);
        left: 10px !important;
        right: 10px;
    }

    .word-explanation-popup::before,
    .word-explanation-popup::after {
        left: 30px;
    }
}

/* WordPress admin spesifikt */
.wp-admin .word-explanation-popup {
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .word-explanation-popup {
        background: #2c3e50;
        border-color: #3498db;
        color: #ecf0f1;
    }

    .word-explanation-popup h4 {
        color: #ecf0f1;
    }

    .word-explanation-popup p {
        color: #bdc3c7;
    }

    .word-explanation-popup .close-btn {
        color: #bdc3c7;
    }

    .word-explanation-popup .close-btn:hover {
        background: #34495e;
        color: #ecf0f1;
    }
}

/* Print styles - skjul popups ved utskrift */
@media print {
    .word-explanation-popup {
        display: none !important;
    }

    .explainable-word {
        background: none !important;
        color: inherit !important;
        border-bottom: 1px solid #ccc;
    }
}