/* ========================================================
   style2.css — Lafzikar Home Page Styles
   Extracted from inline <style> and style="" attributes in home.php
   ======================================================== */

/* ----- Theme Variables ----- */
:root {
    --font-family: 'AMBILE', 'Noto Naskh Arabic', sans-serif;
    --font-heading: 'AMBILE SK Shadow', 'Noto Naskh Arabic', sans-serif;
    
    /* High-quality dark theme color palette */
    --bg-gradient: radial-gradient(circle at 50% 0%, #0d1527 0%, #070a13 100%);
    --search-bg: rgba(18, 26, 47, 0.6);
    --search-border: rgba(56, 139, 253, 0.4);
    --search-border-focus: #58a6ff;
    --accent-glow: rgba(88, 166, 255, 0.35);
    --text-heading: #f0f6fc;
    --text-muted: #8b949e;
    --card-hover-bg: rgba(30, 41, 69, 0.8);
    --btn-bg: #388bfd;
    --btn-text: #ffffff;
}

[data-theme="light"] {
    /* High-quality light theme color palette */
    --bg-gradient: radial-gradient(circle at 50% 0%, #f0f4f9 0%, #e2e8f0 100%);
    --search-bg: rgba(255, 255, 255, 0.85);
    --search-border: rgba(9, 105, 218, 0.3);
    --search-border-focus: #0969da;
    --accent-glow: rgba(9, 105, 218, 0.2);
    --text-heading: #1f2328;
    --text-muted: #657b83;
    --card-hover-bg: rgba(255, 255, 255, 0.95);
    --btn-bg: #0969da;
    --btn-text: #ffffff;
}

/* ----- Base ----- */
body {
    font-family: var(--font-family) !important;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    background: var(--bg-gradient) !important;
    color: var(--pico-color);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading) !important;
}

/* ----- Nav Bar ----- */
header.nav-header {
    border-bottom: 1px solid var(--pico-border-color);
    background: rgba(18, 26, 47, 0.15);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.6rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--pico-color);
}

.logo i {
    color: var(--btn-bg);
    text-shadow: 0 0 10px var(--accent-glow);
}

/* ----- Header Nav Actions (was inline on the nav-actions div) ----- */
.nav-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Header nav links (was inline on <a> tags) */
.nav-link {
    border: none;
    padding: 0;
    color: var(--text-muted);
}

/* Theme toggle button (was inline on #theme-toggle) */
#theme-toggle {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-color: var(--pico-border-color);
}

/* ----- Centering Wrapper ----- */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Centering vertically */
    align-items: center;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    box-sizing: border-box;
}

/* Align to top if search results exist */
.content-wrapper.has-results {
    justify-content: flex-start;
    padding-top: 1rem;
}

/* ----- Search Section Container ----- */
.search-section {
    width: 100%;
    max-width: 820px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: auto 0;
}

.content-wrapper.has-results .search-section {
    margin: 0 0 2rem 0;
}

.hero-section h1 {
    font-size: 3.2rem;
    font-weight: 800;
    color: var(--text-heading);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.hero-section p {
    color: var(--text-muted);
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ----- Bigger, Premium Search Box card ----- */
.search-card {
    background: var(--search-bg);
    border: 1px solid var(--search-border);
    border-radius: 20px;
    padding: 2.2rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    width: 100%;
    text-align: right;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.search-card:focus-within {
    border-color: var(--search-border-focus);
    box-shadow: 0 0 25px var(--accent-glow);
}

.search-form {
    display: flex;
    gap: 15px;
    align-items: center;
    margin: 0;
    width: 100%;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    margin: 0;
}

.search-input-wrapper i {
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.5rem;
    z-index: 5;
}

/* ----- Bigger Search Input Box ----- */
.search-input {
    width: 100%;
    height: 80px !important;
    padding-right: 60px !important;
    padding-left: 20px !important;
    font-family: var(--font-family) !important;
    font-size: 1.8rem !important;
    border-radius: 14px !important;
    border: 1px solid var(--pico-border-color) !important;
    background: var(--pico-background-color) !important;
    margin-bottom: 0 !important;
    outline: none;
    box-sizing: border-box;
}

.search-input:focus {
    border-color: var(--search-border-focus) !important;
    box-shadow: 0 0 0 4px var(--accent-glow) !important;
}

/* ----- Search Button ----- */
.btn-search {
    height: 50px !important;
    width: 50px !important; /* Make it square for the icon */
    padding: 0 !important;
    font-family: var(--font-family) !important;
    font-size: 1.2rem !important;
    font-weight: 700;
    border-radius: 50% !important; /* Make it round */
    margin-bottom: 0 !important;
    background-color: var(--btn-bg) !important;
    border: none !important;
    color: var(--btn-text) !important;
    cursor: pointer;
    box-shadow: 0 4px 14px var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0px; /* Remove gap as there's only an icon */
}

.btn-search:hover {
    opacity: 0.95;
    box-shadow: 0 6px 20px var(--accent-glow);
    transform: translateY(-1px);
}

.search-tips {
    margin-top: 1.2rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 5px;
}

.search-tips i {
    color: var(--btn-bg);
}

/* ----- Errors ----- */
.error-message {
    background: rgba(248, 81, 73, 0.12);
    border: 1px solid var(--pico-form-element-invalid-border-color);
    border-radius: 10px;
    padding: 1.2rem;
    color: var(--pico-form-element-invalid-active-border-color);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 1rem;
    animation: shake 0.4s ease-in-out;
    text-align: right;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ----- Results Display Grid ----- */
.results-section {
    width: 100%;
    max-width: 820px;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-bottom: 2rem;
}

.results-header {
    border-bottom: 1px solid var(--pico-border-color);
    padding-bottom: 0.6rem;
    text-align: right;
}

/* Results header h4 (was inline on the <h4>) */
.results-header h4 {
    margin: 0;
    color: var(--text-heading);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 18px;
    width: 100%;
}

.word-card {
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    font-size: 1.6rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.2s ease-in-out;
}

.word-card:hover {
    border-color: var(--search-border-focus);
    box-shadow: 0 6px 20px var(--accent-glow);
    transform: translateY(-4px);
    background: var(--card-hover-bg);
}

.word-card .hover-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.word-card:hover .hover-hint {
    opacity: 1;
}

/* ----- Popups and Drawer styling ----- */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drawer-overlay.active {
    display: block;
    opacity: 1;
}

.meaning-drawer {
    position: fixed;
    background: var(--pico-background-color);
    border: 1px solid var(--pico-border-color);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.35);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
}

/* Desktop Modal Style (width >= 768px) */
@media (min-width: 768px) {
    .meaning-drawer {
        width: 600px;
        max-height: 80vh;
        border-radius: 16px;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -40%) scale(0.95);
        opacity: 0;
        pointer-events: none;
    }

    .meaning-drawer.active {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
        pointer-events: auto;
    }
}

/* Mobile Bottom Sheet Style (width < 768px) */
@media (max-width: 767.98px) {
    .meaning-drawer {
        width: 100%;
        max-height: 68vh;
        border-radius: 20px 20px 0 0;
        bottom: 0;
        left: 0;
        right: 0;
        transform: translateY(100%);
    }

    .meaning-drawer.active {
        transform: translateY(0);
    }
}

.drawer-header {
    padding: 1.2rem 1.8rem;
    border-bottom: 1px solid var(--pico-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.swipe-handle {
    display: none;
    width: 44px;
    height: 5px;
    background: var(--pico-border-color);
    border-radius: 3px;
    margin: 8px auto 0 auto;
}

@media (max-width: 767.98px) {
    .swipe-handle {
        display: block;
    }
}

.drawer-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--search-border-focus);
    margin: 0;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0;
    margin: 0;
    line-height: 1;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-close:hover {
    background: rgba(255,255,255,0.08);
    color: var(--pico-color);
}

.drawer-content {
    padding: 1.8rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: right;
}

.meaning-entry {
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-border-color);
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
}

.meaning-entry[dir="rtl"] {
    text-align: right;
}

.meaning-entry[dir="ltr"] {
    text-align: left;
}

.dict-source {
    font-size: 0.9rem;
    color: var(--search-border-focus);
    font-weight: 700;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.meaning-text {
    font-size: 1.25rem;
    line-height: 1.65;
}

.fallback-container {
    text-align: center;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.btn-external {
    font-weight: 700;
    font-family: var(--font-family) !important;
}

/* ----- Footer ----- */
footer {
    background: rgba(18, 26, 47, 0.15);
    border-top: 1px solid var(--pico-border-color);
    padding: 1.2rem 0;
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: auto;
}

/* Footer container (was inline on footer .container) */
.footer-container {
    max-width: 1000px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Footer links row (was inline on footer links div) */
.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 5px;
}

/* Footer link styling (was inline on footer <a> tags) */
.footer-link {
    color: var(--text-muted);
    text-decoration: none;
}

/* Footer credits row (was inline on the credits div) */
.footer-credits {
    border-top: 1px solid var(--pico-border-color);
    padding-top: 10px;
}

/* Footer team link (was inline on the sindhsalamat <a>) */
.footer-credits a {
    color: var(--btn-bg);
}

/* ----- Priority Colors for Word Cards ----- */
.word-card.priority-1 { border-color: #dc3545; } /* Lowest priority: red */
.word-card.priority-2 { border-color: #ffc107; } /* Low-Medium priority: yellow/gold */
.word-card.priority-3 { border-color: #0d6efd; } /* Medium-High priority: blue */
.word-card.priority-4 { border-color: #198754; } /* Highest priority: green */

.markdown-body {
    text-align: right;
    direction: rtl;
}

/* ----- Pagination Styling ----- */
.pagination-wrapper {
    margin-top: 2.5rem;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    list-style: none;
    gap: 10px;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination li {
    margin: 0;
}

.pagination li a, .pagination li span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--pico-border-color);
    border-radius: 10px;
    background: var(--search-bg);
    color: var(--pico-color);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 600;
}

.pagination li a:hover {
    border-color: var(--search-border-focus);
    background: var(--card-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.pagination li.active span {
    background: var(--btn-bg);
    color: var(--btn-text);
    border-color: var(--btn-bg);
    box-shadow: 0 4px 14px var(--accent-glow);
}

.pagination li i {
    font-size: 0.9rem;
}

/* ----- JS-injected drawer content helpers ----- */
.drawer-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.drawer-loading i {
    font-size: 2rem;
    margin-bottom: 10px;
}

.fallback-icon {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.fallback-container p.text-muted {
    color: var(--text-muted);
}

.fallback-container p.text-error {
    color: var(--pico-form-element-invalid-active-border-color);
}

.fallback-divider {
    border-top: 1px solid var(--pico-border-color);
    padding-top: 1.5rem;
}

.fallback-divider p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.btn-external-inline {
    font-size: 0.95rem;
    padding: 8px 16px;
    border-color: var(--search-border-focus);
}
