/**
 * أنماط تطبيق مفردات - مطابقة للتطبيق السابق (app/old)
 * خط Tajawal، ألوان #4CAF50
 */

.app-body {
    padding-bottom: 70px;
    min-height: 100vh;
    font-family: 'Tajawal', sans-serif;
    --primary-color: #4CAF50;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
	display: none;
}

.app-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
    /* display: flex; */
    justify-content: center;
    align-items: center;
}

.app-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-logo img {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 50%;
}

.app-main {
    padding: 0rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* إعلانات أسفل المحتوى (فوق شريط التبويب) — من لوحة الأدمن */
.app-footer-ads {
    text-align: center;
    padding: 0.75rem 1rem 0.5rem;
    max-width: 1200px;
    margin: 0 auto;
}
.app-footer-ads .site-ad-item {
    margin-bottom: 0.5rem;
}
.app-footer-ads .site-ad-item:last-child {
    margin-bottom: 0;
}
.app-footer-ads img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

/* شريط التبويبات السفلي */
.app-bottom-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 0.5rem 0;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    z-index: 200;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}

.app-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.6rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    transition: color 0.2s, background 0.2s;
    border-radius: 8px;
    min-width: 50px;
}

.app-tab i {
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.app-tab:hover,
.app-tab:focus {
    color: #4CAF50;
}

.app-tab.active {
    color: #4CAF50;
    font-weight: 600;
}

.app-tab.active i {
    color: #4CAF50;
}

/* تحسين عرض المحتوى في التطبيق */
.app-main .container {
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
}

.app-main .words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* بطاقات التطبيق: الأيقونة والنص في نفس السطر */
.app-main .verb-info-item,
.app-main .verb-form-item {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.app-main .verb-info-item i,
.app-main .verb-form-item i {
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
}

.app-main .verb-info-item .info-label,
.app-main .verb-form-item .form-label {
    white-space: nowrap;
}

.app-main .verb-info-item .info-value,
.app-main .verb-form-item .form-value {
    flex: 1;
    min-width: 0;
}

/* منع التفاف العناصر على الشاشات الصغيرة - إبقاء الأيقونة والنص في سطر واحد */
@media (max-width: 768px) {
    .app-main .verb-info-item {
        flex-wrap: nowrap !important;
    }

    .app-main .verb-info-item .info-label {
        width: auto !important;
        min-width: auto !important;
    }

    .app-main .verb-form-item {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }

    .app-main .verb-form-item .form-label {
        width: auto !important;
        min-width: auto !important;
    }

    .app-main .verb-form-item .form-value {
        margin-left: var(--spacing-xs, 0.25rem) !important;
        margin-top: 0 !important;
    }
}

/* صفحة المزيد */
.app-more-section {
    padding: 1rem 0 2rem;
}

.more-group {
    margin-bottom: 1.5rem;
}

.more-group-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    padding-right: 0.5rem;
}

.more-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.more-list li {
    margin: 0;
    border-bottom: 1px solid var(--border-color);
}

.more-list a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    color: #333;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.more-list a:hover {
    background: var(--bg-tertiary);
    color: #4CAF50;
}

.more-list a i {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
    color: #4CAF50;
}

.more-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.more-footer a {
    color: #4CAF50;
    text-decoration: none;
}

.more-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .app-tab span {
        font-size: 0.65rem;
    }
    .app-tab {
        min-width: 44px;
        padding: 0.3rem 0.4rem;
    }
}

/* صفحات تضمين الأدوات والتعلم */
.app-embed-header {
    padding: 0.75rem 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}
.app-embed-header .container {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.app-back-link {
    color: #4CAF50;
    text-decoration: none;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.app-back-link:hover {
    text-decoration: underline;
}
.app-embed-title {
    font-size: 1.1rem;
    margin: 0;
    font-weight: 600;
}
.app-embed-wrapper {
    width: 100%;
    min-height: calc(100vh - 140px);
    padding: 0;
}
.app-embed-content {
    width: 100%;
    padding: 0;
}
.app-embed-iframe {
    width: 100%;
    min-height: calc(100vh - 140px);
    border: none;
    display: block;
}

/* ===== السحب للتحديث (Pull-to-Refresh) ===== */
.pull-to-refresh {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 150;
    transform: translateY(-100%);
    transition: transform 0.2s ease-out;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    pointer-events: none;
}

.pull-to-refresh.pulling {
    transition: none;
}

.pull-to-refresh.visible {
    transform: translateY(0);
}

.pull-to-refresh.loading .pull-to-refresh-icon {
    animation: pull-refresh-spin 0.8s linear infinite;
}

.pull-to-refresh-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #4CAF50;
    font-size: 0.9rem;
}

.pull-to-refresh-icon {
    font-size: 1.1rem;
}

@keyframes pull-refresh-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* منع السحب الافتراضي للمتصفح على الهواتف */
.app-body {
    overscroll-behavior-y: contain;
}

/* بطاقة الفعل فقط (عند عدم وجود أسماء مشتقة) */
.verb-only-card .word-box {
    padding: 1.25rem;
}
.verb-only-card .verb-only-hint {
    margin: 0.75rem 0 1rem;
    color: #666;
    font-size: 0.95rem;
}
