/* Dhammapada Online CSS Styles - Enhanced Beautiful Design */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700&family=Noto+Serif:wght@300;400;500;600;700&display=swap');

/* Beautiful Background Gradients */
body {
    background: linear-gradient(135deg, 
        #fef3e2 0%, 
        #fdf2f8 20%, 
        #f0f9ff 40%, 
        #f3f4f6 60%, 
        #fdf4ff 80%, 
        #fffbeb 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

.pali-text {
    font-family: 'Sarabun', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #92400e;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.thai-text {
    font-family: 'Sarabun', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    color: #1e40af;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.hidden-thai {
    position: relative;
    background-color: #f3f4f6;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    padding: 0.5rem;
}

.hidden-thai > * {
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.2s ease-in-out;
}

.hidden-thai.reveal-thai > * {
    visibility: visible;
    opacity: 1;
}

.sentence-pair {
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.column-row {
    display: flex;
    margin-bottom: 0.5rem;
    min-height: fit-content;
}

.column-item {
    flex: 1;
    padding: 0.5rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: flex-start;
}

.navigation-controls {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(248, 250, 252, 0.9) 50%,
        rgba(241, 245, 249, 0.95) 100%);
    backdrop-filter: blur(20px);
    z-index: 10;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    margin-bottom: 1rem;
    transition: all 0.3s ease-in-out;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0 0 16px 16px;
}

.navigation-controls.hidden {
    transform: translateY(-100%);
}

.main-content {
    margin-top: 0;
}

/* Beautiful Content Areas */
#columnView, #lineView {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.98) 0%,
        rgba(248, 250, 252, 0.95) 25%,
        rgba(241, 245, 249, 0.92) 50%,
        rgba(248, 250, 252, 0.95) 75%,
        rgba(255, 255, 255, 0.98) 100%);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    position: relative;
    overflow: hidden;
}

#columnView::before, #lineView::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%);
    pointer-events: none;
    border-radius: inherit;
}

.book-grid-view {
    margin-top: 0 !important; /* No margin for book selection */
}

.panel-toggle {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 11;
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.9) 0%,
        rgba(59, 130, 246, 0.95) 50%,
        rgba(37, 99, 235, 1) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: none;
    cursor: pointer;
    box-shadow: 
        0 8px 25px rgba(59, 130, 246, 0.4),
        0 4px 10px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.panel-toggle:hover {
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 1) 0%,
        rgba(59, 130, 246, 1) 50%,
        rgba(37, 99, 235, 1) 100%);
    transform: scale(1.1);
    box-shadow: 
        0 12px 35px rgba(59, 130, 246, 0.5),
        0 6px 15px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.hero-background {
    background: linear-gradient(135deg, 
        rgba(255, 253, 245, 0.8) 0%,
        rgba(254, 248, 180, 0.6) 15%,
        rgba(253, 240, 150, 0.5) 30%,
        rgba(252, 220, 120, 0.45) 45%,
        rgba(248, 200, 90, 0.5) 60%,
        rgba(235, 170, 80, 0.6) 75%,
        rgba(210, 140, 70, 0.7) 90%,
        rgba(185, 120, 65, 0.75) 100%);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(15px);
}

.hero-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(252, 220, 120, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(235, 170, 80, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(248, 200, 90, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 60% 90%, rgba(254, 248, 180, 0.07) 0%, transparent 40%),
        linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.12) 50%, transparent 70%);
    pointer-events: none;
    animation: shimmer 10s ease-in-out infinite alternate;
}

@keyframes shimmer {
    0% { opacity: 0.6; }
    100% { opacity: 0.9; }
}

.floating-decoration {
    position: absolute;
    opacity: 0.1;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(3deg); }
}

.book-grid-enhanced {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(254, 253, 240, 0.9) 25%,
        rgba(254, 251, 210, 0.85) 50%,
        rgba(255, 255, 255, 0.9) 75%,
        rgba(254, 248, 180, 0.75) 100%);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 2px solid rgba(252, 220, 120, 0.25);
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.08),
        0 10px 10px -5px rgba(0, 0, 0, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    position: relative;
}

.book-grid-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%);
    border-radius: inherit;
    pointer-events: none;
}

/* Select2 TOC Styling */
.select2-container .select2-selection--single {
    height: 32px;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
}

.select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 30px;
    padding-left: 8px;
    font-size: 0.875rem;
}

.select2-container .select2-selection--single .select2-selection__arrow {
    height: 30px;
}

.select2-dropdown {
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 4px 8px;
}

/* Font Size Control */
.content-font-size-80 .pali-text {
    font-size: 0.88rem !important;
}
.content-font-size-80 .thai-text {
    font-size: 0.8rem !important;
}

.content-font-size-90 .pali-text {
    font-size: 0.99rem !important;
}
.content-font-size-90 .thai-text {
    font-size: 0.9rem !important;
}

.content-font-size-110 .pali-text {
    font-size: 1.21rem !important;
}
.content-font-size-110 .thai-text {
    font-size: 1.1rem !important;
}

.content-font-size-120 .pali-text {
    font-size: 1.32rem !important;
}
.content-font-size-120 .thai-text {
    font-size: 1.2rem !important;
}

.content-font-size-130 .pali-text {
    font-size: 1.43rem !important;
}
.content-font-size-130 .thai-text {
    font-size: 1.3rem !important;
}

.content-font-size-140 .pali-text {
    font-size: 1.54rem !important;
}
.content-font-size-140 .thai-text {
    font-size: 1.4rem !important;
}

.content-font-size-150 .pali-text {
    font-size: 1.65rem !important;
}
.content-font-size-150 .thai-text {
    font-size: 1.5rem !important;
}

.content-font-size-160 .pali-text {
    font-size: 1.76rem !important;
}
.content-font-size-160 .thai-text {
    font-size: 1.6rem !important;
}

.content-font-size-170 .pali-text {
    font-size: 1.87rem !important;
}
.content-font-size-170 .thai-text {
    font-size: 1.7rem !important;
}

.content-font-size-180 .pali-text {
    font-size: 1.98rem !important;
}
.content-font-size-180 .thai-text {
    font-size: 1.8rem !important;
}

.content-font-size-190 .pali-text {
    font-size: 2.09rem !important;
}
.content-font-size-190 .thai-text {
    font-size: 1.9rem !important;
}

.content-font-size-200 .pali-text {
    font-size: 2.2rem !important;
}
.content-font-size-200 .thai-text {
    font-size: 2.0rem !important;
}

/* Word Click Styles */
.pali-word, .thai-word {
    cursor: pointer;
    padding: 3px 2px;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline;
    position: relative;
}

/* Prevent word breaking in Pali text */
.pali-word {
    white-space: nowrap;
}

.pali-text {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.pali-word:hover {
    background: linear-gradient(135deg,
        rgba(251, 191, 36, 0.15) 0%,
        rgba(245, 158, 11, 0.2) 50%,
        rgba(217, 119, 6, 0.25) 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.thai-word:hover {
    background: linear-gradient(135deg,
        rgba(59, 130, 246, 0.15) 0%,
        rgba(37, 99, 235, 0.2) 50%,
        rgba(29, 78, 216, 0.25) 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.word-highlighted {
    background: linear-gradient(135deg,
        rgba(251, 191, 36, 0.6) 0%,
        rgba(245, 158, 11, 0.7) 50%,
        rgba(217, 119, 6, 0.8) 100%) !important;
    font-weight: 600;
    transform: translateY(-1px);
    box-shadow: 
        0 4px 12px rgba(251, 191, 36, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Translation Results Styles */
.translation-content {
    font-size: 1rem;
    line-height: 1.6;
}

.similar-word {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
    background: white;
    margin-bottom: 8px;
}

.similar-word:hover {
    background-color: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.similar-word strong {
    color: #1f2937;
    font-weight: 600;
}

.similar-word.border-warning {
    border-left: 4px solid #f59e0b;
    border-top: 1px solid #f3f4f6;
    border-right: 1px solid #f3f4f6;
    border-bottom: 1px solid #f3f4f6;
    background-color: #fefefe;
}

.similar-word.border-info {
    border-left: 4px solid #3b82f6;
    border-top: 1px solid #f3f4f6;
    border-right: 1px solid #f3f4f6;
    border-bottom: 1px solid #f3f4f6;
    background-color: #fefefe;
}

.similar-word.border-secondary {
    border-left: 4px solid #9ca3af;
    border-top: 1px solid #f3f4f6;
    border-right: 1px solid #f3f4f6;
    border-bottom: 1px solid #f3f4f6;
    background-color: #fefefe;
}

.similar-word.border-warning:hover {
    background-color: #fffbf0;
    border-left-color: #d97706;
}

.similar-word.border-info:hover {
    background-color: #f8faff;
    border-left-color: #2563eb;
}

.similar-word.border-secondary:hover {
    background-color: #f8f9fa;
    border-left-color: #6b7280;
}

.similar-word.border-success {
    border-left: 4px solid #10b981;
    border-top: 1px solid #f3f4f6;
    border-right: 1px solid #f3f4f6;
    border-bottom: 1px solid #f3f4f6;
    background-color: #fefefe;
}

.similar-word.border-success:hover {
    background-color: #f0fdf4;
    border-left-color: #059669;
}

/* Translation Offcanvas Font Size Control */
.translation-font-size-80 .translation-content {
    font-size: 0.8rem !important;
}
.translation-font-size-80 .similar-word {
    font-size: 0.85rem !important;
}

.translation-font-size-90 .translation-content {
    font-size: 0.9rem !important;
}
.translation-font-size-90 .similar-word {
    font-size: 0.95rem !important;
}

.translation-font-size-110 .translation-content {
    font-size: 1.1rem !important;
}
.translation-font-size-110 .similar-word {
    font-size: 1.15rem !important;
}

.translation-font-size-120 .translation-content {
    font-size: 1.2rem !important;
}
.translation-font-size-120 .similar-word {
    font-size: 1.25rem !important;
}

.translation-font-size-130 .translation-content {
    font-size: 1.3rem !important;
}
.translation-font-size-130 .similar-word {
    font-size: 1.35rem !important;
}

.translation-font-size-140 .translation-content {
    font-size: 1.4rem !important;
}
.translation-font-size-140 .similar-word {
    font-size: 1.45rem !important;
}

.translation-font-size-150 .translation-content {
    font-size: 1.5rem !important;
}
.translation-font-size-150 .similar-word {
    font-size: 1.55rem !important;
}

.translation-font-size-160 .translation-content {
    font-size: 1.6rem !important;
}
.translation-font-size-160 .similar-word {
    font-size: 1.65rem !important;
}

.translation-font-size-170 .translation-content {
    font-size: 1.7rem !important;
}
.translation-font-size-170 .similar-word {
    font-size: 1.75rem !important;
}

.translation-font-size-180 .translation-content {
    font-size: 1.8rem !important;
}
.translation-font-size-180 .similar-word {
    font-size: 1.85rem !important;
}

.translation-font-size-190 .translation-content {
    font-size: 1.9rem !important;
}
.translation-font-size-190 .similar-word {
    font-size: 1.95rem !important;
}

.translation-font-size-200 .translation-content {
    font-size: 2.0rem !important;
}
.translation-font-size-200 .similar-word {
    font-size: 2.05rem !important;
}

/* Translation Details Styles */
.translation-content .btn-outline-secondary.btn-sm,
.similar-word .btn-outline-secondary.btn-sm {
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid #dee2e6;
    background-color: transparent;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    opacity: 0.7;
}

.translation-content .btn-outline-secondary.btn-sm:hover,
.similar-word .btn-outline-secondary.btn-sm:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
    opacity: 1;
    transform: scale(1.05);
}

.translation-content .btn-outline-secondary.btn-sm:focus,
.similar-word .btn-outline-secondary.btn-sm:focus {
    box-shadow: none;
}

.translation-content .btn-outline-secondary.btn-sm:active,
.similar-word .btn-outline-secondary.btn-sm:active {
    background-color: #5a6268 !important;
    border-color: #545b62 !important;
    transform: scale(0.95);
}

.translation-content .bi-info-circle,
.similar-word .bi-info-circle {
    font-size: 0.875rem;
}

.translation-content .card-body,
.similar-word .card-body {
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.translation-content .card-body strong,
.similar-word .card-body strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

/* Details Content Styles */
.details-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.details-content .card-body {
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    margin: 0;
}

.details-content .card-body strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.details-content .card-body div {
    font-size: 1rem;
}

/* Clickable Meaning Lines */
.clickable-meaning {
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.clickable-meaning:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

.meaning-line {
    padding: 0.75rem;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Beautiful Offcanvas */
.offcanvas {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.98) 0%,
        rgba(248, 250, 252, 0.95) 25%,
        rgba(241, 245, 249, 0.92) 50%,
        rgba(248, 250, 252, 0.95) 75%,
        rgba(255, 255, 255, 0.98) 100%);
    backdrop-filter: blur(20px);
    border-top: 2px solid rgba(0, 0, 0, 0.06);
    box-shadow: 
        0 -25px 50px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.offcanvas-header {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(248, 250, 252, 0.85) 100%);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 0 0 16px 16px;
}

.offcanvas-body {
    background: transparent;
}

.bg-very-light {
    --bs-bg-opacity: 1;
    background-color: rgb(246 246 246) !important;
}