/* ============================================
   RECIPE EASY - SENIOR FRIENDLY RECIPE SITE
   Optimized for iOS 18+, Fast Loading, Elegant Design
   ============================================ */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #ff9800;
    --dark-color: #2c3e50;
    --light-color: #f8f9fa;
    --text-color: #333;
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    font-size: 16px;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

header {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

.navbar-brand {
    font-family: 'Playfair Display', serif;
    letter-spacing: 1px;
}

.navbar-nav .nav-link {
    font-weight: 500;
    margin: 0 10px;
    transition: var(--transition);
    font-size: 1.1rem;
}

.navbar-nav .nav-link:hover {
    color: var(--accent-color) !important;
    transform: translateY(-2px);
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero-section {
    min-height: 500px;
    display: flex;
    align-items: center;
    background-size: cover;
    background-position: center;
    position: relative;
}

.hero-section h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-section .lead {
    font-size: 1.3rem;
    margin-bottom: 30px;
    line-height: 1.8;
}

.hero-section img {
    max-width: 100%;
    height: auto;
    animation: slideInRight 0.8s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   CATEGORY CARDS
   ============================================ */

.category-card {
    transition: var(--transition);
    display: block;
}

.hover-card {
    transition: var(--transition);
    cursor: pointer;
}

.hover-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

.category-card:hover .card-img-top {
    filter: brightness(0.9);
}

.card-img-top {
    height: 200px;
    object-fit: cover;
    transition: var(--transition);
}

.card-title {
    color: var(--dark-color);
    font-size: 1.3rem;
    transition: var(--transition);
}

.card-body {
    padding: 1.5rem;
}

/* ============================================
   RECIPE CARDS
   ============================================ */

.recipe-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.recipe-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.recipe-image {
    height: 250px;
    overflow: hidden;
    background: #e0e0e0;
}

.recipe-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.recipe-card:hover .recipe-image img {
    transform: scale(1.1);
}

.recipe-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.recipe-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 10px;
    line-height: 1.3;
}

.recipe-description {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 15px;
    flex-grow: 1;
}

.recipe-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.9rem;
    color: #888;
}

.recipe-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.recipe-button {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white !important;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    margin-top: auto;
}

.recipe-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* ============================================
   CATEGORY SECTIONS
   ============================================ */

.category-section {
    padding: 60px 0;
    border-bottom: 1px solid #eee;
}

.category-section h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--dark-color);
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 20px;
}

.category-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

/* ============================================
   BUTTONS & FORMS
   ============================================ */

.btn-warning {
    background-color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    font-weight: 600;
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 8px;
    transition: var(--transition);
}

.btn-warning:hover {
    background-color: #e68900 !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
    border: none;
    font-weight: 600;
    padding: 12px 30px;
    border-radius: 8px;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.form-control {
    border-radius: 8px;
    border: 2px solid #ddd;
    padding: 12px 15px;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* ============================================
   FOOTER
   ============================================ */

footer {
    background: linear-gradient(135deg, #2c3e50, #3d5a7e) !important;
    margin-top: 80px;
}

footer h5 {
    color: var(--accent-color);
    font-weight: 700;
}

footer a:hover {
    color: var(--accent-color) !important;
    transition: var(--transition);
}

footer hr {
    border-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
}

.lead {
    font-weight: 400;
    font-size: 1.2rem;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .hero-section {
        min-height: 400px;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .hero-section .lead {
        font-size: 1.1rem;
    }

    .category-section h2 {
        font-size: 1.8rem;
    }

    .recipe-title {
        font-size: 1.2rem;
    }

    .navbar-nav .nav-link {
        font-size: 1rem;
        margin: 5px 0;
    }

    .recipe-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================
   ACCESSIBILITY FOR SENIORS (55+)
   ============================================ */

/* Larger touch targets */
button, a.btn, .btn, input[type="button"], input[type="submit"] {
    min-height: 50px;
    min-width: 50px;
}

/* Focus outlines for keyboard users */
:focus {
    outline: 3px solid #ffd27f;
    outline-offset: 3px;
}

/* Ensure skip link is visually hidden until focused */
.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: #fff;
    color: #000;
    padding: 8px;
    z-index: 1000;
}

.skip-link:focus {
    left: 10px;
}

/* Increase readable font size for seniors */
body { font-size: 18px; }

/* Make recipe action buttons larger and focus-visible */
.recipe-button, .permalink-link {
    min-height: 48px;
    padding: 12px 18px;
    border-radius: 10px;
}

/* Increase line height for better readability */
body {
    line-height: 1.8;
}

/* High contrast text */
a {
    color: var(--primary-color);
    font-weight: 500;
}

a:hover {
    color: var(--secondary-color);
}

/* Better spacing for touch devices */
.card {
    margin-bottom: 20px;
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

img {
    max-width: 100%;
    height: auto;
    display: block;
    will-change: transform;
}

/* Lazy loading for images */
img[loading="lazy"] {
    background-color: #f0f0f0;
}

/* Hardware acceleration */
.hover-card,
.recipe-card,
.category-card {
    will-change: transform;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* ============================================
   iOS 18+ SPECIFIC OPTIMIZATIONS
   ============================================ */

@supports (padding: max(0px)) {
    body {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Notch support */
@supports (padding: max(0px)) {
    header {
        padding-top: max(0px, env(safe-area-inset-top));
    }
}

/* Haptic feedback simulation */
button:active,
.btn:active,
a:active {
    opacity: 0.8;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.container {
    max-width: 1200px;
}

.shadow-sm {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

.shadow-lg {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

.text-muted {
    color: #888 !important;
}

.mt-5 {
    margin-top: 3rem !important;
}

.mb-5 {
    margin-bottom: 3rem !important;
}

.py-5 {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

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

.recipe-card {
    animation: slideUp 0.6s ease forwards;
}

.recipe-card:nth-child(1) { animation-delay: 0.1s; }
.recipe-card:nth-child(2) { animation-delay: 0.2s; }
.recipe-card:nth-child(3) { animation-delay: 0.3s; }
.recipe-card:nth-child(4) { animation-delay: 0.4s; }
.recipe-card:nth-child(5) { animation-delay: 0.5s; }

/* ============================================
   LOADING STATES
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    header, footer {
        display: none;
    }

    .recipe-card {
        page-break-inside: avoid;
    }
}
