:root {
    --bg-color: #726C54;
    --card-bg: #F2EFE5;
    --primary: #D8C3A5;
    --primary-dark: #8F7657;
    --accent-red: #C0392B;
    --text-on-bg: #FFFFFF;
    --text-on-card: #2D2D2D;
    --text-sub: #EAEAEA;
    --text-sub-card: #666666;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.15);
}

* {
    box-sizing: border-box;
}

/* Force Hide Utility */
.hidden {
    display: none !important;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Quicksand', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-on-bg);
    min-height: 100vh;
    padding-top: 130px;
    padding-bottom: 40px;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-attachment: fixed;
}

/* --- ANIMATIONS --- */
.view-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    display: none;
}

.view-section:not(.hidden) {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* --- NAVBAR --- */
.navbar {
    position: fixed;
    top: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    z-index: 1000;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease;
    
}

.nav-container {
    pointer-events: auto;
    background: rgba(242, 239, 229, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 25px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-width: 320px;
    max-width: 90%;
    border: 1px solid rgba(143, 118, 87, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.navbar.hidden {
    transform: translateY(-120px) scale(0.95);
    opacity: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.logo-text {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.icon-box {
    width: 35px;
    height: 35px;
    background: var(--primary-dark);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #FFF;
    font-size: 0.9rem;
}

.favorites-link {
    background: transparent;
    border: 1px solid rgba(143, 118, 87, 0.3);
    border-radius: 20px;
    padding: 8px 16px;
    color: var(--primary-dark);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.favorites-link:hover {
    background: var(--primary-dark);
    color: white;
}

@media (max-width: 480px) {
    .nav-container {
        padding: 8px 15px;
        width: 90%;
    }

    .nav-label {
        display: none;
    }

    .logo-text {
        font-size: 1rem;
    }
}

/* --- HERO --- */
.hero {
    text-align: center;
    margin-bottom: 40px;
    padding: 0 20px;
}

.pill {
    background: rgba(255, 255, 255, 0.15);
    color: #FFF;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
}

.hero h1 {
    color: var(--text-on-bg);
    font-weight: 700;
    line-height: 1.2;
    font-size: 3rem;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.hero-sub {
    color: var(--text-sub);
    margin-bottom: 30px;
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.search-wrapper {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-sub-card);
}

.search-wrapper input {
    width: 100%;
    padding: 16px 20px 16px 50px;
    border-radius: 50px;
    border: none;
    background: var(--card-bg);
    font-family: 'Quicksand', sans-serif;
    font-size: 1rem;
    color: var(--text-on-card);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    outline: none;
    transition: all 0.3s;
}

.search-wrapper input:focus {
    box-shadow: 0 0 0 4px rgba(216, 195, 165, 0.4);
    transform: translateY(-2px);
}

/* --- GRID --- */
.app-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.category-section {
    margin-bottom: 50px;
}

/* Fonts */
.category-title {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 10px;
    display: inline-block;
}

.emotions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.emotion-btn {
    background: var(--card-bg);
    color: var(--text-on-card);
    border-radius: 16px;
    padding: 25px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.emotion-btn:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.emoji {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

.emotion-name {
    font-weight: 600;
    text-transform: capitalize;
}

/* --- VERSE CARD --- */
.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;           
    max-width: 650px;      
    margin-left: auto;    
    margin-right: auto; 
    padding: 0 5px;       
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 30px;
    border: none;
    font-size: 0.9rem;
    color: #FFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    transition: background 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

#current-mood-tag {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #FFF;
    font-weight: 700;
    text-transform: uppercase;
}

.card-wrapper {
    max-width: 650px;
    margin: 0 auto;
}

.verse-card {
    background: var(--card-bg);
    color: var(--text-on-card);
    border-radius: 24px;
    padding: 50px 40px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
    text-align: center;
    position: relative;
    overflow: visible;
    margin-bottom: 30px;
}

.save-btn-corner {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    color: #AAA;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.save-btn-corner:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--accent-red);
    transform: scale(1.1);
}

.save-btn-corner.active {
    color: var(--accent-red);
    background: rgba(192, 57, 43, 0.1);
}

.print-header {
    font-family: 'Quicksand', sans-serif;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 30px;
    display: none;
}

.arabic-text {
    font-family: 'Amiri', serif;
    font-size: 2.4rem;
    line-height: 2.2;
    color: var(--text-on-card);
    margin-bottom: 25px;
    direction: rtl;
}

.divider {
    height: 2px;
    width: 50px;
    background: var(--primary-dark);
    margin: 25px auto;
    opacity: 0.3;
}

.transliteration {
    font-style: italic;
    color: var(--text-sub-card);
    margin-bottom: 15px;
    line-height: 1.5;
}

.translation {
    font-weight: 600;
    font-size: 1.15rem;
    margin-bottom: 25px;
    line-height: 1.7;
    color: var(--text-on-card);
}

.reference-badge {
    display: inline-block;
    border: 1px solid var(--primary-dark);
    color: var(--primary-dark);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
}

.ai-btn {
    width: 100%;
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    border: none;
    padding: 15px;
    border-radius: 12px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(253, 160, 133, 0.3);
    transition: transform 0.2s;
    margin-bottom: 15px;
}

.ai-btn:hover {
    transform: scale(1.02);
}

#ai-reflection-box {
    background: #FFF;
    border-left: 4px solid #fda085;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #444;
    text-align: left;
}

#ai-reflection-box.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

.ai-loading {
    text-align: center;
    margin-bottom: 10px;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #fda085;
    border-radius: 50%;
    margin: 0 3px;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

.action-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    gap: 15px;
}

.action-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px;
    border-radius: 10px;
    color: #FFF;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.nav-controls {
    display: flex;
    gap: 15px;
}

.nav-btn {
    flex: 1;
    background: var(--card-bg);
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-on-card);
    transition: transform 0.2s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.next-btn {
    background: var(--primary);
    color: #000000;
    flex: 2;
}

.nav-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* --- FAVORITES --- */
.view-title {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: #FFF;
}

.favorites-grid {
    display: grid;
    gap: 20px;
    padding-bottom: 50px;
}

.favorites-grid .verse-card {
    margin-bottom: 0;
    padding: 30px;
    cursor: pointer;
    transition: transform 0.2s;
}

.favorites-grid .verse-card:hover {
    transform: scale(1.02);
}

.favorites-grid .print-header {
    display: block !important;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

/* Header shows in favorites */

.empty-state {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 60px;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.home-btn-small {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    font-weight: 700;
    margin-top: 20px;
    cursor: pointer;
}

/* --- TOAST --- */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    animation: slideUp 0.3s ease;
}

.toast.hidden {
    display: none !important;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.toast-content i {
    color: #2ecc71;
}

.toast-btn {
    background: none;
    border: none;
    color: #fda085;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9rem;
}

/* --- FOOTER & MODAL --- */
.site-footer {
    text-align: center;
    margin-top: 40px;
    color: var(--text-sub);
    font-size: 0.9rem;
    opacity: 0.8;
}

.author-link,
.footer-link {
    color: #FFF;
    text-decoration: none;
    font-weight: 700;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #FFF;
    width: 90%;
    max-width: 500px;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    color: #333;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.alert-box {
    background: #FFF4E5;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #FFA500;
    font-size: 0.9rem;
}

.alert-box a {
    color: #D35400;
    font-weight: 700;
}

/* --- IMAGE DOWNLOAD --- */
.watermark {
    display: none !important;
}

.capturing .watermark {
    display: block !important;
    margin-top: 40px;
    font-family: 'Amiri', serif;
    color: #999;
    font-size: 1.2rem;
    letter-spacing: 1px;
}

.capturing {
    position: fixed !important;
    top: -9999px !important;
    left: -9999px !important;
    border-radius: 0;
    box-shadow: none;
    border: none;
    aspect-ratio: 1 / 1;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 60px !important;
    background-color: #F2EFE5 !important;
    width: 800px !important;
    height: 800px !important;
    color: #2D2D2D !important;
    text-align: center !important;
}

.capturing .save-btn-corner {
    display: none !important;
}

.capturing .verse-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.capturing .print-header {
    display: block !important;
    font-family: 'Quicksand', sans-serif;
    font-size: 1.4rem;
    color: var(--primary-dark);
    font-weight: 700;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .category-section {
        text-align: center;
    }
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}