/* 
 * Bhagavad Gita PWA - Main Stylesheet
 * Features: Glass morphism, responsive design, PWA optimization
 * Note: Uses modern CSS properties with webkit fallbacks for compatibility
 */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Custom tooltip styling */
[title] {
    position: relative;
}

[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #dc3545;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
    z-index: 10001;
    margin-bottom: 5px;
    animation: tooltipFadeIn 0.2s ease-in-out;
}

[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #dc3545;
    z-index: 10001;
    margin-bottom: -5px;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

body {
    font-family: 'Roboto', sans-serif;
    background: url('krishna-and-arjuna.jpg') no-repeat center center fixed;
    background-size: cover;
    color: #333;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-x: hidden;
    font-weight: 400;
}

.chapter-card h3 {
    color: #E65100;
    margin-bottom: 10px;
    font-weight: 500;
}

.chapter-card p {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #BF360C;
}

header {
    position: fixed;
    top: 0;
    width: 100%;
    background: #E6A623;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    padding: 10px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

header h1 {
    flex: 1;
    text-align: center;
    font-size: 2.7rem;
    color: #A5252C;
    font-weight: 950;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

#back-btn {
    position: absolute;
    left: 20px;
    background: transparent;
    color: #A5252C;
    border: none;
    padding: 0;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: none;
    font-size: 1.5rem;
}

#back-btn:hover {
    transform: scale(1.1);
}

#ai-btn {
    position: absolute;
    right: 20px;
    background: transparent;
    color: #A5252C;
    border: none;
    padding: 0;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: none;
    font-size: 1.5rem;
}

#ai-btn:hover {
    transform: scale(1.1);
    color: #D32F2F;
}

.ai-icon-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s;
}

#ai-btn:hover .ai-icon-img {
    transform: scale(1.1);
}

.ai-setup-icon {
    width: 48px !important;
    height: 48px !important;
}

#lang-switcher-old {
    display: none;
}

#lang-switcher:hover {
    transform: scale(1.1);
}

main {
    flex: 1;
    padding: 85px 10px 80px 10px; /* Account for header and audio controls */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.screen {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.screen.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    background: #E6A623;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    padding: 10px;
    text-align: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

footer p {
    color: #A5252C;
    margin: 0;
}

/* Chapters list */
#chapters-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.chapter-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.chapter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 193, 7, 0.6), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.chapter-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.25);
}

.chapter-card:hover::before {
    opacity: 1;
}

.chapter-card h3 {
    color: #D32F2F;
    font-weight: 500;
}

.chapter-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 10px;
}

.chapter-header .chapter-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chapter-header h3 {
    color: #A5252C;
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
}

.chapter-meaning {
    font-size: 0.85rem;
    color: #8D6E63;
    font-style: italic;
    margin: 2px 0;
}

.chapter-stats {
    position: absolute;
    top: 0;
    right: 0;
}

.verse-count {
    background: rgba(255, 193, 7, 0.2);
    color: #E65100;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(255, 193, 7, 0.4);
}

.chapter-number {
    background: #E6A623;
    color: #A5252C;
    border: none;
    border-radius: 50%;
    width: 49px;
    height: 49px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
}

.chapter-card:hover .chapter-number {
    background: #D49A21;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(165, 37, 44, 0.4);
}

.chapter-card p {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #333;
}

/* Verses list */
#verses-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#chapter-title {
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.3;
}

.chapter-title-name {
    color: #A5252C;
    font-size: 1.5rem;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.chapter-title-meaning {
    color: #8D6E63;
    font-size: 1.1rem;
    font-style: italic;
    margin-top: 5px;
}

.verse-item {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    border-left: 4px solid rgba(255, 152, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 15px;
}

.verse-number {
    background: #E6A623;
    color: #A5252C;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
}

.verse-text {
    flex: 1;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    line-height: 1.4;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2; /* Standard property for future compatibility */
    overflow: hidden;
    text-overflow: ellipsis;
}

.verse-item:hover {
    background: rgba(255, 193, 7, 0.25);
    transform: translateX(8px) scale(1.01);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.15);
}

.verse-item:hover .verse-number {
    background: #D49A21;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(165, 37, 44, 0.4);
}

/* Verse detail */
.language-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.language-dropdown-container {
    position: relative;
}

.language-dropdown {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 2px solid rgba(165, 37, 44, 0.3);
    border-radius: 15px;
    padding: 6px 12px;
    color: #A5252C;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    min-width: 80px;
    text-align: center;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A5252C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    padding-right: 28px;
}

.language-dropdown:hover {
    background: rgba(165, 37, 44, 0.1);
    border-color: #A5252C;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(165, 37, 44, 0.3);
}

.language-dropdown:focus {
    border-color: #A5252C;
    box-shadow: 0 0 0 3px rgba(165, 37, 44, 0.1);
}

/* Glass cards for verse content */
.glass-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin: 15px 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255, 193, 7, 0.6), rgba(255, 152, 0, 0.6), transparent);
    opacity: 0.7;
}

#verse-sanskrit-card {
    border-color: rgba(230, 81, 0, 0.3);
}

#verse-translation-card {
    border-color: rgba(255, 193, 7, 0.3);
}

#verse-sanskrit-card::before {
    background: linear-gradient(90deg, transparent, rgba(230, 81, 0, 0.6), rgba(255, 87, 34, 0.6), transparent);
}

#verse-translation-card::before {
    background: linear-gradient(90deg, transparent, rgba(255, 193, 7, 0.6), rgba(255, 152, 0, 0.6), transparent);
}

/* Sloka number pill */
.sloka-number-pill {
    background: rgba(255, 193, 7, 0.2);
    color: #E65100;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: block;
    text-align: center;
    margin: 0 auto 15px auto;
    width: fit-content;
    border: 1px solid rgba(255, 193, 7, 0.4);
}

#verse-text, #verse-transliteration, #verse-translation {
    margin-bottom: 15px;
    line-height: 1.6;
}

#verse-text {
    font-size: 1.2rem;
    font-weight: bold;
    color: #E65100;
    text-align: center;
    margin-bottom: 15px;
}

#verse-transliteration {
    font-style: italic;
    color: #5D4E75;
    text-align: center;
    font-weight: 400;
    font-size: 0.95rem;
    opacity: 0.85;
    margin-bottom: 0;
}

#verse-translation {
    text-align: justify;
    font-size: 1.1rem;
    line-height: 1.7;
    font-weight: 500;
    color: #2C2C2C;
    margin-bottom: 0;
    padding: 15px;
    background: rgba(255, 193, 7, 0.25);
    border-radius: 12px;
}

/* Audio controls */
#audio-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #E6A623;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px 15px 0 0;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.1);
    z-index: 1001;
}

#audio-controls::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 152, 0, 0.6), transparent);
}

#play-pause-btn {
    background: #D32F2F;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

#play-pause-btn:hover {
    background: #B71C1C;
}

#seek-slider {
    flex: 1;
    max-width: 300px;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #D32F2F;
    border-radius: 5px;
    outline: none;
}

#seek-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #B71C1C;
    border-radius: 50%;
    cursor: pointer;
}

#current-time, #duration {
    color: #D32F2F;
    font-weight: 500;
}

/* Floating Audio Button */
#floating-audio-btn {
    position: fixed;
    bottom: 75px;
    right: 5px;
    z-index: 1002;
}

.progress-ring {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
}

.progress-ring-svg {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotate(-90deg);
    width: 64px;
    height: 64px;
}

.progress-ring-circle {
    stroke-dasharray: 182.21;
    stroke-dashoffset: 182.21;
    transition: stroke-dashoffset 0.1s ease;
}

#floating-play-pause {
    background: #E6A623;
    border: none;
    border-radius: 50%;
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: #A5252C;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

#floating-play-pause:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
}

#floating-time {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: bold;
    color: #A5252C;
    background: rgba(230, 166, 35, 0.9);
    padding: 4px 10px;
    border-radius: 12px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Verse Navigation Footer */
#verse-navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #E6A623;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

#prev-verse-btn, #next-verse-btn {
    background: #A5252C;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.3);
}

#prev-verse-btn:hover, #next-verse-btn:hover {
    background: #8E1E24;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(165, 37, 44, 0.4);
}

#prev-verse-btn:disabled, #next-verse-btn:disabled {
    background: rgba(165, 37, 44, 0.5);
    cursor: not-allowed;
    transform: none;
}

#verse-slider-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 20px;
}

#verse-slider {
    width: 100%;
    max-width: 300px;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(165, 37, 44, 0.3);
    border-radius: 3px;
    outline: none;
    margin-bottom: 5px;
}

#verse-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #A5252C;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(165, 37, 44, 0.4);
}

#verse-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #D32F2F;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(211, 47, 47, 0.4);
}

#verse-counter {
    font-size: 14px;
    font-weight: bold;
    color: #A5252C;
    text-align: center;
}

/* Responsive */
@media (max-width: 600px) {
    #chapters-list {
        grid-template-columns: 1fr;
    }
    header h1 {
        font-size: 1.8rem;
        font-weight: 950;
    }
    main {
        padding: 70px 5px 50px 5px;
    }
}

/* AI Feature Styles */
.ai-setup-card {
    max-width: 500px;
    margin: 50px auto;
    text-align: center;
}

.ai-setup-header {
    margin-bottom: 30px;
}

.ai-setup-header .ai-icon {
    font-size: 3rem;
    color: #A5252C;
    margin-bottom: 15px;
}

.ai-setup-header h2 {
    color: #A5252C;
    font-size: 2rem;
    margin-bottom: 10px;
}

.ai-setup-header p {
    color: #8D6E63;
    font-style: italic;
    margin-bottom: 0;
}

.ai-setup-content p {
    color: #333;
    margin-bottom: 20px;
    font-weight: 500;
}

.api-key-input-group {
    display: flex;
    position: relative;
    margin-bottom: 20px;
}

#api-key-input {
    flex: 1;
    padding: 12px 50px 12px 15px;
    border: 2px solid rgba(165, 37, 44, 0.3);
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

#api-key-input:focus {
    border-color: #A5252C;
}

#toggle-api-key-visibility {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #8D6E63;
    cursor: pointer;
    font-size: 16px;
}

.ai-save-btn {
    background: #A5252C;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.ai-save-btn:hover {
    background: #D32F2F;
    transform: translateY(-2px);
}

.api-key-help a {
    color: #A5252C;
    text-decoration: none;
}

.api-key-help a:hover {
    text-decoration: underline;
}

/* AI Chat Styles - Full Glass Page */
#ai-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px); /* Account for navbar (60px) and footer (80px) */
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
}

#ai-chat-header {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #A5252C;
    font-size: 18px;
    font-weight: 600;
}

#ai-chat-header span {
    flex: 1;
}

#clear-chat-btn {
    background: transparent;
    border: none;
    color: #A5252C;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s;
}

#clear-chat-btn:hover {
    background: rgba(165, 37, 44, 0.1);
    transform: scale(1.1);
}

#ai-chat-header i {
    font-size: 20px;
}

#ai-chat-messages {
    flex: 1;
    background: transparent;
    padding: 20px 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Chat message markdown styles */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3 {
    margin: 10px 0 5px 0;
    color: #A5252C;
}

.message-bubble h1 {
    font-size: 1.3em;
}

.message-bubble h2 {
    font-size: 1.2em;
}

.message-bubble h3 {
    font-size: 1.1em;
}

.message-bubble strong {
    font-weight: 600;
    color: #8B1538;
}

.message-bubble em {
    font-style: italic;
    color: #A5252C;
}

.message-bubble code {
    background: rgba(165, 37, 44, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-bubble pre {
    background: rgba(165, 37, 44, 0.1);
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.message-bubble pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.message-bubble ul {
    margin: 10px 0;
    padding-left: 20px;
}

.message-bubble li {
    margin: 5px 0;
}

#ai-starter-prompts {
    padding: 10px 0;
    background: transparent;
    overflow: hidden;
}

.starter-prompts-carousel {
    display: flex;
    gap: 8px;
    padding: 0 15px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}

.starter-prompts-carousel::-webkit-scrollbar {
    display: none;
}

/* Chat message markdown styles */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3 {
    margin: 10px 0 5px 0;
    color: #A5252C;
}

.message-bubble h1 {
    font-size: 1.3em;
}

.message-bubble h2 {
    font-size: 1.2em;
}

.message-bubble h3 {
    font-size: 1.1em;
}

.message-bubble strong {
    font-weight: 600;
    color: #8B1538;
}

.message-bubble em {
    font-style: italic;
    color: #A5252C;
}

.message-bubble code {
    background: rgba(165, 37, 44, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-bubble pre {
    background: rgba(165, 37, 44, 0.1);
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.message-bubble pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.message-bubble ul {
    margin: 10px 0;
    padding-left: 20px;
}

.message-bubble li {
    margin: 5px 0;
}

.starter-prompt {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #A5252C;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: fit-content;
}

.starter-prompt:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    border-color: rgba(165, 37, 44, 0.3);
}

.starter-prompt:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

#ai-chat-input-container {
    display: flex;
    padding: 20px 15px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    gap: 10px;
}

#ai-chat-input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid rgba(165, 37, 44, 0.3);
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    background: rgba(255, 255, 255, 0.9);
    transition: border-color 0.3s;
}

#ai-chat-input:focus {
    border-color: #A5252C;
}

#ai-send-btn {
    background: #A5252C;
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ai-send-btn:hover {
    background: #D32F2F;
    transform: scale(1.1);
}

/* Chat Message Styles */
.chat-message {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-message.user {
    align-items: flex-end;
}

.chat-message.ai {
    align-items: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
}

.chat-message.user .message-bubble {
    background: #A5252C;
    color: white;
    border-bottom-right-radius: 6px;
}

.chat-message.ai .message-bubble {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border-bottom-left-radius: 6px;
}

.sarthi-response {
    margin-bottom: 10px;
}

.sloka-pills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sloka-pill {
    background: #A5252C;
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
}

.sloka-pill:hover {
    background: #D32F2F;
    transform: translateY(-2px);
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    max-width: 80px;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #A5252C;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { 
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* Floating Settings Button */
.floating-settings-btn {
    position: fixed;
    bottom: 55px;
    right: 5px;
    z-index: 1000;
}

.main-floating-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: #E6A623;
    border: none;
    color: #A5252C;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
}

.floating-menu {
    position: absolute;
    bottom: 55px;
    right: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.floating-menu.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.floating-option-btn {
    position: absolute;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: #E6A623;
    border: none;
    color: #A5252C;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    right: 0;
}

.floating-option-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
}

/* Position each button with proper spacing */
.floating-option-btn:nth-child(1) { /* Settings button */
    bottom: 5px;
}

.floating-option-btn:nth-child(2) { /* Bookmarks button */
    bottom: 65px;
}

/* Remove the close button styling since we'll use main button transformation */
.close-btn {
    display: none;
}

/* Animation for showing buttons */
.floating-menu:not(.show) .floating-option-btn {
    transform: scale(0) rotate(180deg);
    opacity: 0;
}

.floating-menu.show .floating-option-btn {
    transform: scale(1) rotate(0deg);
    opacity: 1;
}

.floating-menu.show .floating-option-btn:nth-child(1) {
    transition-delay: 0.1s;
}

.floating-menu.show .floating-option-btn:nth-child(2) {
    transition-delay: 0.2s;
}

/* Main button icon transformation */
.main-floating-btn i {
    transition: all 0.3s ease;
}

.main-floating-btn.opened i::before {
    content: "\f00d"; /* FontAwesome times/X icon */
}

.main-floating-btn.opened {
    transform: rotate(45deg);
}

/* Settings Screen Styles */
.settings-card {
    max-width: 500px;
    margin: 20px auto;
    padding: 30px;
}

.settings-header h2 {
    color: #A5252C;
    margin-bottom: 5px;
    font-size: 24px;
}

.settings-header p {
    color: #666;
    margin-bottom: 30px;
}

.setting-item {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.setting-item h3 {
    color: #A5252C;
    margin-bottom: 10px;
    font-size: 18px;
}

.setting-item p {
    color: #666;
    margin-bottom: 15px;
    font-size: 14px;
}

.api-key-btn {
    background: linear-gradient(135deg, #E6A623, #D4A017);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-right: 10px;
    margin-top: 10px;
}

.api-key-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(230, 166, 35, 0.4);
}

/* Settings API Key Input Styles */
#settings-api-key-input {
    width: 100%;
    padding: 12px 50px 12px 16px;
    border: 2px solid rgba(165, 37, 44, 0.2);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #333;
    font-family: inherit;
    height: 42px;
}

#settings-api-key-input:focus {
    border-color: #A5252C;
    box-shadow: 0 0 0 3px rgba(165, 37, 44, 0.1);
    background: rgba(255, 255, 255, 0.15);
}

#settings-api-key-input::placeholder {
    color: #999;
    font-style: italic;
}

#toggle-settings-api-key-visibility {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #A5252C;
    cursor: pointer;
    font-size: 18px;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#toggle-settings-api-key-visibility:hover {
    background: rgba(165, 37, 44, 0.1);
    transform: translateY(-50%) scale(1.1);
}

.setting-item .api-key-input-group {
    position: relative;
    margin-bottom: 20px;
}

.api-key-btn.remove-btn {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.api-key-btn.remove-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

.api-key-help {
    margin-bottom: 20px;
    padding: 12px 15px;
    background: rgba(230, 166, 35, 0.1);
    border-left: 3px solid #E6A623;
    border-radius: 0 8px 8px 0;
}

.api-key-help small {
    color: #8D6E63;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.api-key-help a {
    color: #A5252C;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.api-key-help a:hover {
    color: #E6A623;
    text-decoration: underline;
}

.api-key-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.api-key-btn i {
    margin-right: 8px;
    font-size: 14px;
}

.setting-item h3 i {
    margin-right: 10px;
    color: #E6A623;
}

.sarthi-icon {
    width: 24px;
    height: 24px;
    margin-right: 10px;
    vertical-align: middle;
    border-radius: 4px;
}

.api-key-btn.icon-btn {
    width: 40px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-size: 14px;
}

.api-key-btn.icon-btn i {
    margin: 0;
}

#update-api-key-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
}

#update-api-key-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

#save-translate-language-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    width: 100%;
    margin-top: 15px;
}

#save-translate-language-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.remove-btn {
    background: linear-gradient(135deg, #D32F2F, #B71C1C);
}

.remove-btn:hover {
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.4);
}

/* Bookmarks Screen Styles */
.bookmarks-header {
    text-align: center;
    padding: 20px;
    margin-bottom: 20px;
}

.bookmarks-header h2 {
    color: #A5252C;
    margin-bottom: 10px;
    font-size: 24px;
}

.bookmarks-header p {
    color: #666;
}

.bookmarks-list {
    padding: 0 20px 20px;
}

.bookmark-item {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    margin-bottom: 15px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.bookmark-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.bookmark-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.bookmark-sloka-number {
    background: linear-gradient(135deg, #E6A623, #D4A017);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

.remove-bookmark-btn {
    background: none;
    border: none;
    color: #D32F2F;
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.remove-bookmark-btn:hover {
    background: rgba(211, 47, 47, 0.1);
    transform: scale(1.1);
}

.bookmark-text {
    color: #8B1538;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.bookmark-translation {
    color: #666;
    font-size: 14px;
    font-style: italic;
}

/* Verse Card Header */
.verse-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}



.bookmark-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 2px solid rgba(165, 37, 44, 0.3);
    border-radius: 15px;
    padding: 4px 8px;
    color: #A5252C;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 11px;
    min-width: 35px;
    min-height: 28px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    flex-shrink: 0;
}

.bookmark-btn:hover:not(.bookmarked) {
    background: rgba(165, 37, 44, 0.1);
    border-color: #A5252C;
    transform: translateY(-2px);
}

.bookmark-btn.bookmarked {
    background: #A5252C;
    color: white;
    border-color: #A5252C;
    box-shadow: 0 4px 12px rgba(165, 37, 44, 0.3);
}

.bookmark-btn.bookmarked:hover {
    background: #8B1F24;
    border-color: #8B1F24;
}

/* Hide floating settings button on specific screens */
.screen.active ~ .floating-settings-btn {
    display: block;
}

#verse-detail-screen.active ~ .floating-settings-btn,
#ai-chat-screen.active ~ .floating-settings-btn,
#ai-setup-screen.active ~ .floating-settings-btn {
    display: none;
}

/* Sarthi Translate Settings */
.sarthi-translate-settings {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.sarthi-translate-settings h3 {
    color: #A5252C;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sarthi-translate-settings h3 i {
    font-size: 20px;
}

.language-preference-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.language-select {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid rgba(165, 37, 44, 0.3);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: #333;
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
    outline: none;
    transition: all 0.3s ease;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23A5252C' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 45px;
}

.language-select:focus {
    border-color: #A5252C;
    box-shadow: 0 0 0 3px rgba(165, 37, 44, 0.1);
    transform: translateY(-1px);
}

.language-select:hover {
    border-color: rgba(165, 37, 44, 0.5);
    background: rgba(255, 255, 255, 1);
}

.language-select option {
    padding: 10px;
    font-size: 16px;
    background: white;
    color: #333;
}

.sarthi-language-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid rgba(165, 37, 44, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
    outline: none;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.sarthi-language-select:focus {
    border-color: #A5252C;
    box-shadow: 0 0 0 3px rgba(165, 37, 44, 0.1);
}

.save-language-btn {
    background: linear-gradient(135deg, #A5252C, #E6A623);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.save-language-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(165, 37, 44, 0.3);
}

.save-language-btn:active {
    transform: translateY(0);
}

/* SarthiAI Language Pill */
.sarthi-ai-pill {
    background: linear-gradient(135deg, #00c6ff 0%, #0072ff 50%, #667eea 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 15px rgba(0, 198, 255, 0.4);
    position: relative;
    overflow: hidden;
}

.sarthi-ai-pill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.sarthi-ai-pill:hover::before {
    left: 100%;
}

.sarthi-ai-pill:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 198, 255, 0.6);
    background: linear-gradient(135deg, #0072ff 0%, #00c6ff 50%, #764ba2 100%);
}

.sarthi-ai-pill i {
    font-size: 10px;
    animation: pinPulse 2s infinite;
}

@keyframes pinPulse {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(-5deg) scale(1.1); }
}

.sarthi-ai-pill .sparkle {
    font-size: 10px;
    animation: sparkle 2s infinite;
}

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