/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fafafa;
}

/* RTL (Arabic) */
html.rtl body,
[dir="rtl"] body {
    text-align: right;
    font-family: 'Inter', 'Segoe UI', Tahoma, sans-serif;
}
html.rtl .nav-links,
[dir="rtl"] .nav-links { flex-direction: row-reverse; }
html.rtl .recipe-card,
[dir="rtl"] .recipe-card { text-align: right; }
html.rtl .recipe-meta,
[dir="rtl"] .recipe-meta { flex-direction: row-reverse; }
html.rtl .modal-header,
[dir="rtl"] .modal-header { flex-direction: row-reverse; }
html.rtl .ramadan-course-card,
[dir="rtl"] .ramadan-course-card { text-align: right; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container { padding: 0 1.5rem; }
}
@media (min-width: 1024px) {
    .container { padding: 0 2rem; }
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #e5e7eb;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    min-height: 56px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #d97706;
}

.logo i {
    font-size: 1.8rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.lang-switcher {
    display: flex;
    gap: 0.25rem;
}
.lang-btn {
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    min-width: 44px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.lang-btn:hover {
    border-color: #d97706;
    color: #d97706;
}
.lang-btn.active {
    background: #d97706;
    border-color: #d97706;
    color: #fff;
}

.nav-link {
    text-decoration: none;
    color: #6b7280;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
    padding: 0.5rem 0;
    display: inline-block;
    min-height: 44px;
    line-height: 2;
    -webkit-tap-highlight-color: transparent;
}

.nav-link:hover,
.nav-link.active {
    color: #d97706;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    right: 0;
    height: 2px;
    background: #d97706;
    border-radius: 1px;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
    padding: 5rem 0 3rem;
    text-align: center;
    animation: heroFadeIn 0.8s ease-out;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.gradient-text {
    background: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    min-height: 48px;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: #d97706;
    color: white;
}

.btn-primary:hover {
    background: #b45309;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(217, 119, 6, 0.3);
}

.btn-secondary {
    background: white;
    color: #d97706;
    border: 2px solid #d97706;
}

.btn-secondary:hover {
    background: #d97706;
    color: white;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Search Section */
.search-section {
    padding: 4rem 0;
    background: white;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: #1f2937;
}

.search-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

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

.search-input-wrapper i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.search-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    min-height: 48px;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

/* Filters */
.filters {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: end;
    margin-bottom: 2rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.filter-select,
.filter-input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    min-width: 120px;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #d97706;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #d97706;
    border-color: #d97706;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Results Section */
.results-section {
    padding: 2rem 0 4rem;
    min-height: 400px;
}

.loading-spinner {
    text-align: center;
    padding: 3rem 0;
    color: #6b7280;
}

.loading-spinner i {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
    animation: spin 1s linear infinite;
}

.recipe-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.recipe-card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    cursor: pointer;
    border: 1px solid #f3f4f6;
    animation: cardFadeIn 0.5s ease forwards;
}

.recipe-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.1);
}

.recipe-card:active {
    transform: translateY(-2px);
}

.recipe-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #d97706;
}

.recipe-content {
    padding: 1.5rem;
}

.recipe-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1f2937;
}

.recipe-description {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.recipe-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.meta-item i {
    color: #d97706;
}

.recipe-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    padding: 0.25rem 0.5rem;
    background: #fef3c7;
    color: #92400e;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.tag.vegetarian {
    background: #d1fae5;
    color: #065f46;
}

.tag.ramadan {
    background: #e0e7ff;
    color: #3730a3;
}

.no-results {
    text-align: center;
    padding: 4rem 0;
    color: #6b7280;
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #374151;
}

/* Ramadan Section */
.ramadan-page {
    background: #0f172a;
}
.ramadan-page-main {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
}
.ramadan-section-full {
    width: 100%;
    padding: 3rem 0 4rem;
}
.ramadan-section {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #f1f5f9;
    padding: 4rem 0;
    position: relative;
}

.ramadan-section::before {
    content: '';
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 80px;
    height: 80px;
    opacity: 0.15;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fcd34d'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.ramadan-section .container {
    position: relative;
    z-index: 1;
}

.ramadan-section-title {
    font-size: 2.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    color: #fef3c7;
}

.ramadan-section-title i {
    margin-right: 0.5rem;
    color: #fcd34d;
}

.ramadan-subtitle {
    text-align: center;
    color: #94a3b8;
    margin-bottom: 2rem;
    font-size: 1rem;
}

.ramadan-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
    color: #cbd5e1;
}

.ramadan-loading i {
    font-size: 1.5rem;
}

.ramadan-menu {
    max-width: 900px;
    margin: 0 auto;
}

.ramadan-course-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.ramadan-course-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    min-height: 44px;
    animation: cardFadeIn 0.5s ease forwards;
}

.ramadan-course-card:hover {
    background: rgba(51, 65, 85, 0.9);
    border-color: rgba(251, 191, 36, 0.5);
    transform: translateX(4px);
}

.ramadan-course-card:active {
    transform: scale(0.98);
}

.ramadan-course-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fcd34d;
    margin-bottom: 0.35rem;
}

.ramadan-course-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #f8fafc;
    margin-bottom: 0.35rem;
}

.ramadan-course-desc {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    line-height: 1.45;
}

.ramadan-course-link {
    font-size: 0.85rem;
    color: #fcd34d;
    font-weight: 500;
}

.ramadan-course-link i {
    font-size: 0.7rem;
    margin-left: 0.25rem;
}

.ramadan-course-empty {
    cursor: default;
    opacity: 0.85;
}

.ramadan-course-empty:hover {
    transform: none;
}

.ramadan-course-empty-msg {
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.ramadan-error {
    text-align: center;
    color: #fca5a5;
    padding: 2rem;
}

.btn-ramadan {
    display: block;
    margin: 0 auto;
    padding: 0.875rem 1.5rem;
    min-height: 48px;
    background: transparent;
    color: #fcd34d;
    border: 2px solid rgba(252, 211, 77, 0.6);
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.btn-ramadan:hover {
    background: rgba(252, 211, 77, 0.15);
    color: #fef3c7;
}

.btn-ramadan:active {
    transform: scale(0.98);
}

.btn-ramadan i {
    margin-right: 0.5rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: modalFadeIn 0.3s ease;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 1rem;
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-overflow-scrolling: touch;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 2rem;
}

.recipe-detail-section {
    margin-bottom: 2rem;
}

.recipe-detail-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recipe-detail-section h3 i {
    color: #d97706;
}

.ingredients-list {
    list-style: none;
    display: grid;
    gap: 0.5rem;
}

.ingredient-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f9fafb;
    border-radius: 0.5rem;
}

.ingredient-item::before {
    content: '•';
    color: #d97706;
    font-weight: bold;
}

.instructions {
    white-space: pre-line;
    line-height: 1.8;
    color: #374151;
}

.recipe-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.info-card {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
}

.info-card h4 {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-card .value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

/* Footer */
.footer {
    background: #1f2937;
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
    color: #d97706;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #d1d5db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: #d97706;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #374151;
    color: #9ca3af;
}

/* Responsive Design */
@media (max-width: 640px) {
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .nav-link {
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .search-section {
        padding: 2rem 0;
    }

    .filters {
        gap: 1rem;
    }

    .filter-select,
    .filter-input {
        min-width: 100%;
    }

    .recipe-content {
        padding: 1rem;
    }

    .recipe-image {
        height: 160px;
    }

    .modal-content {
        width: 100%;
        max-height: 95vh;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        transform: none;
        border-radius: 1rem 1rem 0 0;
        animation: modalSlideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .modal-header,
    .modal-body {
        padding: 1rem 1.25rem;
    }

    .ramadan-section-title {
        font-size: 1.5rem;
    }

    .ramadan-course-card {
        padding: 1rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (min-width: 640px) {
    .hero-title {
        font-size: 2.5rem;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .recipe-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

@media (min-width: 768px) {
    .hero {
        padding: 6rem 0 4rem;
    }

    .hero-title {
        font-size: 3rem;
    }

    .hero-subtitle {
        font-size: 1.25rem;
        margin-bottom: 2rem;
    }

    .recipe-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 2rem;
    }

    .modal-content {
        width: 90%;
    }
}

@media (min-width: 1024px) {
    .hero {
        padding: 8rem 0 4rem;
    }

    .hero-title {
        font-size: 3.5rem;
    }

    .recipe-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.recipe-card {
    animation: cardFadeIn 0.5s ease forwards;
}

.recipe-card:nth-child(1) { animation-delay: 0.05s; }
.recipe-card:nth-child(2) { animation-delay: 0.1s; }
.recipe-card:nth-child(3) { animation-delay: 0.15s; }
.recipe-card:nth-child(4) { animation-delay: 0.2s; }
.recipe-card:nth-child(5) { animation-delay: 0.25s; }
.recipe-card:nth-child(6) { animation-delay: 0.3s; }
.recipe-card:nth-child(7) { animation-delay: 0.35s; }
.recipe-card:nth-child(8) { animation-delay: 0.4s; }
.recipe-card:nth-child(9) { animation-delay: 0.45s; }
.recipe-card:nth-child(n+10) { animation-delay: 0.5s; }

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Prevent zoom on input focus (iOS) */
@media (max-width: 640px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Safe area for notched devices */
@supports (padding: max(0px)) {
    .header {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}