/* css/style.css */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent: #f59e0b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    padding-bottom: 4rem;
}

h1, h2, h3 {
    font-family: 'Outfit', sans-serif;
}

/* Header & Glassmorphism */
header {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    padding: 4rem 1rem;
    text-align: center;
    color: white;
    margin-bottom: 2rem;
}

.glass-header {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.glass-header h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.15);
    letter-spacing: -0.5px;
}

.glass-header p {
    font-size: 1.2rem;
    opacity: 0.95;
    margin-bottom: 2.5rem;
}

/* Search Controls */
.search-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

input[type="text"], select {
    padding: 0.8rem 1.2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    color: var(--text-main);
}

input[type="text"] {
    flex: 1;
    min-width: 250px;
}

input[type="text"]:focus, select:focus {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.results-info {
    margin-bottom: 1.5rem;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Dictionary Grid */
.dictionary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Card Entry */
.dict-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02), 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dict-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.08);
    border-color: #c7d2fe;
}

.dict-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: var(--primary);
    border-radius: 16px 0 0 16px;
}

.dict-card h3 {
    font-size: 1.6rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    line-height: 1.2;
}

.meaning {
    font-size: 1.15rem;
    color: var(--text-main);
    margin-bottom: 1.2rem;
    font-weight: 500;
    flex-grow: 1;
}

.category-tag {
    display: align-self-start;
    padding: 0.35rem 0.85rem;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

/* Play Button */
.btn-play {
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--primary);
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: 10px;
}

.btn-play:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05); /* Slight pop effect */
}

.btn-play:active {
    transform: scale(0.95);
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}
.empty-state h3 {
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

/* Modal Deklinasi */
.declension-modal {
    margin: auto;
    border: none;
    border-radius: 20px;
    padding: 0;
    max-width: 95%;
    width: 900px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.declension-modal[open] {
    opacity: 1;
    transform: scale(1);
}

.declension-modal::backdrop {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.declension-modal[open]::backdrop {
    opacity: 1;
}

.modal-content {
    padding: 2rem;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: #f1f5f9;
    border: none;
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}

.close-btn:hover {
    background: #ef4444;
    color: white;
}

#declensionTitle {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
    text-align: center;
}

.declension-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

/* Tabel Deklinasi */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
}

.declension-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.95rem;
}

.declension-table th {
    background: linear-gradient(to right, #f8fafc, #f1f5f9);
    color: var(--text-main);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 1rem;
    border-bottom: 2px solid var(--border);
    text-align: left;
}

.declension-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

.declension-table tr:last-child td {
    border-bottom: none;
}

.declension-table tr:hover td {
    background: #f8fafc;
}

.cell-case {
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.cell-fungsi {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.cell-penghubung {
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: 500;
}

.word-combination {
    display: inline-block;
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
    background: #eef2ff;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    border: 1px solid #e0e7ff;
}

.word-combination strong {
    color: var(--primary);
    font-weight: 600;
    font-size: 1.05rem;
}

.word-combination span {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 0.35rem;
    background: white;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    border: 1px dashed #cbd5e1;
}

/* Make Pali words clickable */
.clickable-word {
    cursor: pointer;
    border-bottom: 2px dashed #a5b4fc;
    transition: all 0.2s;
    display: inline-block;
}

.clickable-word:hover {
    color: var(--primary-hover) !important;
    border-bottom-color: var(--primary);
    background: #f5f3ff;
    border-radius: 4px;
}

/* Verb clickable: different accent colour (amber) */
.clickable-verb {
    border-bottom-color: #f59e0b;
}
.clickable-verb:hover {
    background: #fffbeb !important;
    border-bottom-color: #d97706 !important;
}

/* Conjugation Section Headers (scroll layout) */
.conj-section-header {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1.8rem 0 0.8rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #ede9fe, #f5f3ff);
    border-left: 4px solid var(--primary);
    border-radius: 0 8px 8px 0;
    letter-spacing: 0.01em;
}

.conj-section-header span {
    font-weight: 400;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-left: 0.4rem;
}

/* ── Credit Footer ─────────────────────────────────────────────────── */
.credit-footer {
    margin-top: 3rem;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    padding: 2rem 1.5rem;
    text-align: center;
    color: #c7d2fe;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    border-top: 1px solid #4338ca;
}

.credit-inner {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: center;
}

.credit-project {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: #e0e7ff;
}

.credit-project strong {
    color: #a5b4fc;
}

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

.credit-team {
    color: #a5b4fc;
    letter-spacing: 0.02em;
}

.credit-label {
    color: #818cf8;
    font-weight: 600;
    margin-right: 0.4rem;
}

.credit-author {
    margin-top: 0.4rem;
    color: #c7d2fe;
}

.credit-author strong {
    color: #e0e7ff;
}

.credit-link {
    color: #818cf8;
    text-decoration: none;
    border-bottom: 1px dotted #818cf8;
    transition: color 0.2s, border-color 0.2s;
}

.credit-link:hover {
    color: #a5b4fc;
    border-bottom-color: #a5b4fc;
}

/* ── Credit Shortcut: Fixed Floating Button ────────────────────────── */
.credit-btn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.45);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 900;
    user-select: none;
}

.credit-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.6);
}

/* Credit Popup Card */
.credit-popup {
    position: fixed;
    bottom: 4.8rem;
    right: 1.5rem;
    width: 280px;
    background: linear-gradient(145deg, #1e1b4b, #312e81);
    border: 1px solid #4338ca;
    border-radius: 14px;
    padding: 1.2rem 1.3rem 1rem;
    color: #c7d2fe;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    z-index: 899;
    opacity: 0;
    transform: translateY(12px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.credit-popup.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.credit-popup-close {
    position: absolute;
    top: 0.5rem;
    right: 0.7rem;
    background: none;
    border: none;
    color: #818cf8;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.15s;
}

.credit-popup-close:hover { color: #e0e7ff; }

.credit-popup-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #e0e7ff;
    margin-bottom: 0.9rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid #4338ca;
}

.credit-popup-row {
    display: flex;
    gap: 0.7rem;
    margin-bottom: 0.55rem;
    align-items: flex-start;
    line-height: 1.45;
}

.credit-popup-label {
    flex-shrink: 0;
    width: 45px;
    font-weight: 600;
    color: #818cf8;
    font-size: 0.78rem;
    padding-top: 0.05rem;
}

.credit-popup-row strong { color: #a5b4fc; }
