/* ═══════════════════════════════════════════════════
   Language Table Widget — Duolingo-inspired Styles
   ═══════════════════════════════════════════════════ */

/* ── Base Reset ── */
.ltw-table-wrap {
    --ltw-radius: 16px;
    --ltw-shadow: 0 2px 12px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
    --ltw-bg: #FFFFFF;
    --ltw-header-bg: #F7F7F7;
    --ltw-header-color: #777777;
    --ltw-cell-color: #4B4B4B;
    --ltw-divider: #E5E5E5;
    --ltw-hover: #F9F9F9;
    --ltw-accent: #58CC02;
    --ltw-font: 'DIN Round Pro', 'Nunito', system-ui, -apple-system, sans-serif;

    font-family: var(--ltw-font);
    background: var(--ltw-bg);
    border-radius: var(--ltw-radius);
    box-shadow: var(--ltw-shadow);
    overflow: visible;
    max-width: 100%;
}

/* ── Title ── */
.ltw-title {
    font-size: 1.15em;
    font-weight: 800;
    color: var(--ltw-cell-color);
    padding: 20px 24px 0;
    letter-spacing: 0.01em;
}

/* ── Grid Table ── */
.ltw-table {
    display: grid;
    width: 100%;
}

/* ── Header ── */
.ltw-header-cell {
    background: var(--ltw-header-bg);
    color: var(--ltw-header-color);
    font-size: 0.78em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 14px 20px;
    border-bottom: 2px solid var(--ltw-divider);
}

/* ── Cells ── */
.ltw-cell {
    color: var(--ltw-cell-color);
    font-size: 1em;
    font-weight: 600;
    padding: 16px 20px;
    display: block;
    transition: background-color 0.15s ease;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ltw-row:hover {
    background-color: var(--ltw-hover);
}

/* ── First column emphasis ── */
.ltw-cell--first {
    font-weight: 700;
}

/* ── Section Header ── */
.ltw-section-header {
    color: #FFFFFF;
    font-size: 0.85em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 10px 20px;
}

/* ── Colored Text ── */
.ltw-colored {
    font-weight: 700;
}

/* ── Highlighted Text ── */
.ltw-highlight {
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 700;
}

/* ── Subscript / Small ── */
.ltw-sub {
    font-size: 0.78em;
    color: #AFAFAF;
    font-weight: 500;
}

/* ── Tooltip ── */
.ltw-tooltip-wrap {
    position: relative;
    cursor: help;
    font-weight: 700;
}

.ltw-tooltip-bubble {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #333;
    color: #fff;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.82em;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    line-height: 1.3;
}

.ltw-tooltip-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #333;
}

.ltw-tooltip-wrap:hover .ltw-tooltip-bubble,
.ltw-tooltip-wrap:focus .ltw-tooltip-bubble {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ═════════════════════════
   THEME: Duolingo
   ═════════════════════════ */
.ltw-theme-duolingo {
    --ltw-bg: #FFFFFF;
    --ltw-header-bg: #F7F7F7;
    --ltw-header-color: #AFAFAF;
    --ltw-cell-color: #4B4B4B;
    --ltw-divider: #E5E5E5;
    --ltw-hover: #F9F9F9;
    border: 2px solid #E5E5E5;
    box-shadow: 0 4px 0 #E5E5E5;
}

.ltw-theme-duolingo .ltw-header-cell {
    border-bottom: 2px solid #E5E5E5;
}

.ltw-theme-duolingo .ltw-cell--first {
    color: #1CB0F6;
}

/* ═════════════════════════
   THEME: Clean / Minimal
   ═════════════════════════ */
.ltw-theme-clean {
    --ltw-bg: #FFFFFF;
    --ltw-header-bg: transparent;
    --ltw-header-color: #999;
    --ltw-cell-color: #333;
    --ltw-divider: #F0F0F0;
    --ltw-hover: #FAFAFA;
    box-shadow: none;
    border: 1px solid #E8E8E8;
}

/* ═════════════════════════
   THEME: Dark
   ═════════════════════════ */
.ltw-theme-dark {
    --ltw-bg: #1A1A2E;
    --ltw-header-bg: #16213E;
    --ltw-header-color: #6B7B9E;
    --ltw-cell-color: #E0E0E0;
    --ltw-divider: #2A2A4A;
    --ltw-hover: #1F1F3A;
    border: 1px solid #2A2A4A;
}

.ltw-theme-dark .ltw-tooltip-bubble {
    background: #E0E0E0;
    color: #1A1A2E;
}
.ltw-theme-dark .ltw-tooltip-bubble::after {
    border-top-color: #E0E0E0;
}

.ltw-theme-dark .ltw-sub {
    color: #6B7B9E;
}

/* ═════════════════════════
   THEME: Pastel
   ═════════════════════════ */
.ltw-theme-pastel {
    --ltw-bg: #FFF9F0;
    --ltw-header-bg: #FFF0E0;
    --ltw-header-color: #C4956A;
    --ltw-cell-color: #5A4A3A;
    --ltw-divider: #F0E0D0;
    --ltw-hover: #FFF5EA;
    border: 2px solid #F0E0D0;
}

/* ═════════════════════════
   Responsive
   ═════════════════════════ */
@media (max-width: 640px) {
    .ltw-table {
        font-size: 0.9em;
    }
    .ltw-cell,
    .ltw-header-cell {
        padding: 12px 12px;
    }
    .ltw-title {
        padding: 16px 16px 0;
        font-size: 1em;
    }
}

/* ── Animations ── */
@keyframes ltw-fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ltw-table-wrap {
    animation: ltw-fadeIn 0.35s ease-out;
}

/* ═════════════════════════
   Rich Text Widget
   ═════════════════════════ */
/* ═════════════════════════
   Sticky Title & Header
   ═════════════════════════ */
.ltw-title.ltw-sticky {
    position: sticky;
    z-index: 10;
}

.ltw-header-row {
    display: contents;
}

.ltw-richtext {
    font-family: 'DIN Round Pro', 'Nunito', system-ui, -apple-system, sans-serif;
    color: #4B4B4B;
    font-size: 1em;
    font-weight: 600;
    line-height: 1.7;
}

.ltw-richtext p {
    margin-bottom: 0.75em;
}

.ltw-richtext p:last-child {
    margin-bottom: 0;
}

/* ═════════════════════════════════════════════════════
   Callout Widget — Notion-meets-Duolingo Style
   ═════════════════════════════════════════════════════ */
.ltw-callout {
    position: relative;
    font-family: 'DIN Round Pro', 'Nunito', system-ui, -apple-system, sans-serif;
    border-radius: 12px;
    border: 2px solid transparent;
    border-left-width: 4px;
    border-left-style: solid;
    padding: 20px 24px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    animation: ltw-fadeIn 0.35s ease-out;
}

.ltw-callout:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

/* ── Layout: Inline (emoji beside text) ── */
.ltw-callout--inline {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

/* ── Layout: Top (emoji above text) ── */
.ltw-callout--top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.ltw-callout--top .ltw-callout-emoji {
    margin-bottom: 0;
}

/* ── Emoji ── */
.ltw-callout-emoji {
    flex-shrink: 0;
    font-size: 32px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    user-select: none;
}

/* ── Content ── */
.ltw-callout-content {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.ltw-callout-title {
    font-size: 1em;
    font-weight: 800;
    margin-bottom: 4px;
    line-height: 1.3;
    letter-spacing: 0.01em;
}

.ltw-callout-body {
    font-size: 0.92em;
    font-weight: 600;
    line-height: 1.65;
}

.ltw-callout-body p {
    margin-bottom: 0.6em;
}

.ltw-callout-body p:last-child {
    margin-bottom: 0;
}

/* ═════════════════════════
   Preset: Info 💡
   ═════════════════════════ */
.ltw-callout--info {
    background-color: #EBF8FF;
    border-left-color: #1CB0F6;
    border-color: #C7EEFF;
    border-left-color: #1CB0F6;
}
.ltw-callout--info .ltw-callout-title { color: #0A8CD8; }
.ltw-callout--info .ltw-callout-body  { color: #3B6D8F; }

/* ═════════════════════════
   Preset: Warning ⚠️
   ═════════════════════════ */
.ltw-callout--warning {
    background-color: #FFF8EB;
    border-color: #FFE5A0;
    border-left-color: #FF9600;
}
.ltw-callout--warning .ltw-callout-title { color: #B36B00; }
.ltw-callout--warning .ltw-callout-body  { color: #7A5A1F; }

/* ═════════════════════════
   Preset: Danger 🚨
   ═════════════════════════ */
.ltw-callout--danger {
    background-color: #FFF0F0;
    border-color: #FFD0D0;
    border-left-color: #FF4B4B;
}
.ltw-callout--danger .ltw-callout-title { color: #CC2929; }
.ltw-callout--danger .ltw-callout-body  { color: #8F3B3B; }

/* ═════════════════════════
   Preset: Success ✅
   ═════════════════════════ */
.ltw-callout--success {
    background-color: #F0FFF0;
    border-color: #C8F0C8;
    border-left-color: #58CC02;
}
.ltw-callout--success .ltw-callout-title { color: #3A8A00; }
.ltw-callout--success .ltw-callout-body  { color: #3D6B2E; }

/* ═════════════════════════
   Preset: Tip 💬
   ═════════════════════════ */
.ltw-callout--tip {
    background-color: #F8F0FF;
    border-color: #E8D0FF;
    border-left-color: #CE82FF;
}
.ltw-callout--tip .ltw-callout-title { color: #8B4FC6; }
.ltw-callout--tip .ltw-callout-body  { color: #6B4F8A; }

/* ═════════════════════════
   Preset: Note 📝
   ═════════════════════════ */
.ltw-callout--note {
    background-color: #F7F7F7;
    border-color: #E5E5E5;
    border-left-color: #AFAFAF;
}
.ltw-callout--note .ltw-callout-title { color: #666666; }
.ltw-callout--note .ltw-callout-body  { color: #4B4B4B; }

/* ═════════════════════════
   Preset: Custom 🎨
   ═════════════════════════ */
.ltw-callout--custom {
    background-color: #FFFFFF;
    border-color: #E5E5E5;
    border-left-color: #E5E5E5;
}
.ltw-callout--custom .ltw-callout-title { color: #4B4B4B; }
.ltw-callout--custom .ltw-callout-body  { color: #4B4B4B; }

/* ── Responsive ── */
@media (max-width: 480px) {
    .ltw-callout {
        padding: 16px 16px;
    }
    .ltw-callout--inline {
        gap: 12px;
    }
    .ltw-callout-emoji {
        font-size: 24px;
        width: 24px;
        height: 24px;
    }
    .ltw-callout-body {
        font-size: 0.88em;
    }
}
