/* ============================================================================
   Health & Wellness Theme - Optimized for Performance & Accessibility
   ============================================================================ */

/* Font Display Optimization - Reduce Layout Shift */
@font-face {
    font-family: 'Font Awesome 6 Free';
    font-style: normal;
    font-weight: 900;
    font-display: swap;
    src: local('Font Awesome 6 Free Solid');
}

@font-face {
    font-family: 'Font Awesome 6 Free';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: local('Font Awesome 6 Free Regular');
}

@font-face {
    font-family: 'Font Awesome 6 Brands';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: local('Font Awesome 6 Brands Regular');
}

/* CSS Variables - Health & Wellness Color Palette */
:root {
    /* Primary Colors - Green (Health/Growth) */
    --primary-color: #10b981;
    --primary-dark: #059669;
    --primary-light: #34d399;
    --primary-lighter: #d1fae5;

    /* Secondary Colors - Blue (Trust/Calm) */
    --secondary-color: #06b6d4;
    --secondary-dark: #0891b2;
    --secondary-light: #22d3ee;

    /* Accent Colors */
    --accent-mint: #6ee7b7;
    --accent-teal: #5eead4;

    /* Neutral Colors */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;

    /* Status Colors */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 300ms ease-in-out;
    --transition-slow: 500ms ease-in-out;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Spacing */
    --spacing-unit: 0.25rem;
}

/* ============================================================================
   Global Styles & Base
   ============================================================================ */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    line-height: 1.7;
    background-color: var(--bg-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

p {
    margin-bottom: 1.5rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Selection */
::selection {
    background: var(--primary-color);
    color: var(--bg-white);
}

::-moz-selection {
    background: var(--primary-color);
    color: var(--bg-white);
}

/* ============================================================================
   Navigation - Accessibility Enhanced
   ============================================================================ */

.navbar {
    background-color: var(--bg-white) !important;
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    transition: all var(--transition-base);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color) !important;
    transition: transform var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand:hover {
    transform: scale(1.05);
    color: var(--primary-dark) !important;
}

.navbar-brand:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 4px;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color) !important;
    background-color: var(--primary-lighter);
}

.nav-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================================================
   Hero Section
   ============================================================================ */

.hero-section {
    background: linear-gradient(135deg, #10b981 0%, #059669 50%, #0d9488 100%);
    color: var(--bg-white);
    padding: 80px 0;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse"><path d="M 20 0 L 0 0 0 20" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

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

.hero-section h1 {
    color: var(--bg-white);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   Category Header
   ============================================================================ */

.category-header {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: var(--bg-white);
    padding: 60px 0;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-md);
}

/* ============================================================================
   Cards - Enhanced UX
   ============================================================================ */

.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    transition: all var(--transition-base);
    background: var(--bg-white);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl) !important;
    border-color: var(--primary-light);
}

.card:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.card-img-top {
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    transition: transform var(--transition-base);
}

.card:hover .card-img-top {
    transform: scale(1.05);
}

.card-header {
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%) !important;
    border: none !important;
    padding: 0.75rem 1.25rem;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.card-title a {
    color: var(--text-primary);
    transition: color var(--transition-fast);
}

.card-title a:hover {
    color: var(--primary-color);
}

/* ============================================================================
   Buttons - Enhanced with Better Accessibility
   ============================================================================ */

.btn {
    font-weight: 600;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:focus {
    outline: 3px solid rgba(16, 185, 129, 0.5);
    outline-offset: 3px;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--bg-white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: var(--bg-white);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: var(--bg-white);
    box-shadow: var(--shadow-md);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: var(--bg-white);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-dark) 100%);
    color: var(--bg-white);
    box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--secondary-dark) 0%, #0e7490 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: var(--bg-white);
}

.btn-light {
    background: var(--bg-white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    font-weight: 700;
}

.btn-light:hover {
    background: var(--primary-color);
    color: var(--bg-white);
    border-color: var(--primary-color);
}

.btn-sm {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 700;
}

/* ============================================================================
   Post Content - Enhanced Readability
   ============================================================================ */

.post-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.post-content h2 {
    color: var(--primary-dark);
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    font-weight: 700;
    font-size: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--primary-lighter);
}

.post-content h3 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.5rem;
}

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content ul,
.post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.post-content li {
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

.post-content strong {
    color: var(--text-primary);
    font-weight: 700;
}

.post-content a {
    color: var(--primary-color);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
    transition: all var(--transition-fast);
}

.post-content a:hover {
    color: var(--primary-dark);
    text-decoration-thickness: 3px;
}

/* Affiliate Links in Content */
.post-content .affiliate-link {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 3px solid var(--primary-color);
    transition: all var(--transition-base);
    font-weight: 700;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
}

.post-content .affiliate-link:hover {
    color: var(--bg-white);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-bottom-color: var(--primary-dark);
    padding: 4px 8px;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.post-content .affiliate-link:focus {
    outline: 3px solid rgba(16, 185, 129, 0.5);
    outline-offset: 3px;
}

.post-content .affiliate-link strong {
    color: inherit;
}

/* ============================================================================
   Alerts - Improved Styles
   ============================================================================ */

.alert {
    border-radius: var(--radius-lg);
    border: 2px solid;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: var(--success-color);
    color: #065f46;
}

.alert-info {
    background: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%);
    border-color: var(--info-color);
    color: #164e63;
}

.alert-warning {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    border-color: var(--warning-color);
    color: #78350f;
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: var(--danger-color);
    color: #7f1d1d;
}

.alert-heading {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* ============================================================================
   Footer
   ============================================================================ */

footer {
    background-color: var(--bg-light);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

footer a {
    color: var(--text-secondary);
    transition: color var(--transition-fast);
    font-weight: 500;
}

footer a:hover {
    color: var(--primary-color);
}

footer a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ============================================================================
   Breadcrumb
   ============================================================================ */

.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1.5rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1.2rem;
    color: var(--text-muted);
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.breadcrumb-item a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--text-secondary);
}

/* ============================================================================
   Badges
   ============================================================================ */

.badge {
    padding: 0.5rem 1rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
}

.badge.bg-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%) !important;
}

.badge.bg-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%) !important;
}

.badge.bg-info {
    background: linear-gradient(135deg, var(--info-color) 0%, var(--secondary-dark) 100%) !important;
}

.badge.bg-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%) !important;
}

/* ============================================================================
   Tables (Admin)
   ============================================================================ */

.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table-hover tbody tr {
    transition: background-color var(--transition-fast);
}

.table-hover tbody tr:hover {
    background-color: var(--primary-lighter);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(16, 185, 129, 0.05);
}

/* ============================================================================
   Forms & Inputs - Accessibility Enhanced
   ============================================================================ */

.form-control,
.form-select {
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    padding: 0.75rem 1rem;
    transition: all var(--transition-fast);
    font-size: 1rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* ============================================================================
   Utility Classes
   ============================================================================ */

.hover-shadow {
    box-shadow: var(--shadow-sm);
}

.hover-shadow:hover {
    box-shadow: var(--shadow-xl);
}

.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow-md {
    box-shadow: var(--shadow-md) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content-section {
    margin-bottom: 2.5rem;
}

.custom-list {
    list-style: none;
    padding-left: 0;
}

.custom-list li {
    padding-left: 1.5rem;
    position: relative;
    margin-bottom: 0.75rem;
}

.custom-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.2rem;
}

/* ============================================================================
   Animations & Performance Optimizations
   ============================================================================ */

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

.card,
.alert {
    animation: fadeIn 0.5s ease-out;
}

/* Reduce animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================================
   Loading States
   ============================================================================ */

.spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.15rem;
    border-color: var(--primary-color);
    border-right-color: transparent;
}

/* ============================================================================
   Responsive Design - Mobile First
   ============================================================================ */

@media (max-width: 768px) {
    .hero-section {
        padding: 50px 0;
    }

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

    .category-header {
        padding: 40px 0;
    }

    .post-content {
        font-size: 1rem;
    }

    .post-content h2 {
        font-size: 1.5rem;
    }

    .post-content h3 {
        font-size: 1.2rem;
    }

    .btn-lg {
        padding: 0.875rem 1.75rem;
        font-size: 1rem;
    }

    .card-img-top {
        height: 180px;
    }
}

@media (max-width: 576px) {
    :root {
        font-size: 14px;
    }

    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }

    .navbar-brand {
        font-size: 1.25rem;
    }
}

/* ============================================================================
   Print Styles
   ============================================================================ */

@media print {
    .navbar,
    footer,
    .alert,
    .btn,
    .breadcrumb {
        display: none;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
    }

    a {
        text-decoration: underline;
    }

    .post-content {
        font-size: 12pt;
    }
}

/* ============================================================================
   Dark Mode Support (Optional)
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    /* Add dark mode styles here if needed */
}

/* ============================================================================
   Focus Visible (Modern browsers)
   ============================================================================ */

:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ============================================================================
   Lazy Loading & Performance Optimizations
   ============================================================================ */

/* Fade-in animation for lazy loaded images */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Blur-up effect for images */
img.lazy-blur {
    filter: blur(10px);
    transition: filter 0.3s ease-in-out;
}

img.lazy-blur.loaded {
    filter: blur(0);
}

/* Skeleton Loading Styles */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 25%,
        #f0f0f0 50%,
        var(--bg-secondary) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

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

.skeleton-card {
    height: 380px;
    margin-bottom: 1.5rem;
}

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

.skeleton-text {
    height: 1rem;
    margin: 0.5rem 0;
    background: linear-gradient(
        90deg,
        #e0e0e0 25%,
        #f0f0f0 50%,
        #e0e0e0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-text-short {
    width: 60%;
}

/* ============================================================================
   Pagination Styles
   ============================================================================ */
/* Note: Colors are managed dynamically via functions-colors.php */

.pagination {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.pagination .page-link {
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
}

.pagination .page-link:hover {
    transform: translateY(-2px);
}

.pagination .page-item.disabled .page-link {
    cursor: not-allowed;
}

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

/* Loading state for cards */
.card.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Fade-in animation for cards */
.card {
    animation: fadeInUp 0.4s ease-out;
}

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

/* Stagger animation for multiple cards */
.row .col-md-6:nth-child(1) .card,
.row .col-lg-4:nth-child(1) .card {
    animation-delay: 0.05s;
}

.row .col-md-6:nth-child(2) .card,
.row .col-lg-4:nth-child(2) .card {
    animation-delay: 0.1s;
}

.row .col-md-6:nth-child(3) .card,
.row .col-lg-4:nth-child(3) .card {
    animation-delay: 0.15s;
}

.row .col-md-6:nth-child(4) .card,
.row .col-lg-4:nth-child(4) .card {
    animation-delay: 0.2s;
}

.row .col-md-6:nth-child(5) .card,
.row .col-lg-4:nth-child(5) .card {
    animation-delay: 0.25s;
}

.row .col-md-6:nth-child(6) .card,
.row .col-lg-4:nth-child(6) .card {
    animation-delay: 0.3s;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .card,
    img[loading="lazy"],
    .pagination .page-link {
        animation: none;
        transition: none;
    }
}
