/* ============================================================================
   Recipes Page — Refined Athletic
   ========================================================================= */

.container {
    max-width: 1200px;
}

/* ---- Header ---- */
.header {
    text-align: center;
    margin-bottom: var(--space-8);
    padding: var(--space-10) var(--space-6);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-2xl);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--color-primary-subtle) 0%, var(--color-accent-subtle) 100%);
    pointer-events: none;
}

.header h1 {
    position: relative;
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: var(--weight-extrabold);
    color: var(--color-text);
    letter-spacing: -0.03em;
    margin-bottom: var(--space-2);
}

.header p {
    position: relative;
    color: var(--color-text-secondary);
    font-size: var(--text-base);
    margin: 0;
}

/* ---- Search Section ---- */
.search-section {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-subtle);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-6);
}

.search-bar {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.search-bar input {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg-elevated);
    transition: all var(--duration-fast) var(--ease-out);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.search-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}

.search-btn:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Filters */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.filter-group label {
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    font-size: var(--text-sm);
}

.filter-group select,
.filter-group input {
    padding: 10px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg-elevated);
    transition: all var(--duration-fast) var(--ease-out);
    -webkit-appearance: none;
    appearance: none;
}

.filter-group select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23A09A93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M4 6l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 36px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.clear-filters-btn {
    background: var(--color-bg-sunken);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    padding: 10px 16px;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    margin-top: auto;
}

.clear-filters-btn:hover {
    background: var(--color-surface);
    border-color: var(--color-text-muted);
}

.filter-info {
    background: var(--color-info-subtle);
    border: 1px solid var(--color-info-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.filter-count {
    font-weight: var(--weight-semibold);
    color: var(--color-info);
    font-size: var(--text-lg);
}

.active-filters {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

/* Dietary filters */
.dietary-filters {
    background: var(--color-bg-sunken);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-top: var(--space-4);
}

.dietary-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.dietary-filter-header label {
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    font-size: var(--text-sm);
}

.toggle-dietary-filters {
    background: var(--color-bg-elevated);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    padding: 6px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    transition: all var(--duration-fast) var(--ease-out);
}

.toggle-dietary-filters:hover { background: var(--color-surface); }

.dietary-filter-options { display: none; }

.dietary-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.dietary-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.dietary-checkbox input[type="checkbox"] {
    margin: 0;
    accent-color: var(--color-primary);
    width: 16px;
    height: 16px;
}

.dietary-checkbox span { user-select: none; }

/* View toggle */
.view-toggle {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.toggle-btn {
    flex: 1;
    padding: 10px 20px;
    background: var(--color-bg-elevated);
    color: var(--color-text-secondary);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.toggle-btn:hover { background: var(--color-bg-sunken); }

.toggle-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.2);
}

/* ---- Recipe Grid ---- */
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12);
    gap: var(--space-4);
}

.loading .spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.loading p {
    color: var(--color-text-muted);
    margin: 0;
}

.no-results {
    text-align: center;
    padding: var(--space-10);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-xl);
    color: var(--color-text-secondary);
}

/* ---- Recipe Card ---- */
.recipe-card {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    transition: all var(--duration-base) var(--ease-out);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
}

.recipe-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}

.recipe-card.expanded { border-color: var(--color-primary); }
.recipe-card.favorited-card { border-color: var(--color-warning); }

.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.meal-type-badge {
    background: var(--color-primary-subtle);
    color: var(--color-primary);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: capitalize;
}

.favorite-btn {
    background: var(--color-bg-sunken);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.favorite-btn:hover {
    background: var(--color-surface);
}

.favorite-btn.favorited {
    background: var(--color-warning-subtle);
    color: var(--color-warning);
    border-color: var(--color-warning-border);
}

.recipe-name {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    color: var(--color-text);
    margin: 0 0 var(--space-2) 0;
    line-height: var(--leading-snug);
}

.recipe-description {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
    margin: 0 0 var(--space-4) 0;
}

/* Macro display */
.recipe-macros {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background: var(--color-bg-sunken);
    border-radius: var(--radius-lg);
}

.macro-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
}

.macro-icon { font-size: 1.25rem; }

.macro-value {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    color: var(--color-text);
}

.macro-label {
    font-size: 10px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    font-weight: var(--weight-semibold);
}

/* Buttons */
.show-details-btn,
.view-recipe-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    width: 100%;
    transition: all var(--duration-fast) var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 44px;
}

.show-details-btn:hover,
.view-recipe-btn:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

.view-recipe-btn { margin-top: auto; }
.show-details-btn { margin-bottom: var(--space-2); }

/* Recipe details expand */
.recipe-details {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border-subtle);
    animation: slideDown var(--duration-slow) var(--ease-out);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.details-section { margin-bottom: var(--space-4); }

.details-section h4 {
    color: var(--color-text);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    margin: 0 0 var(--space-3) 0;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
}

.ingredients-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ingredients-list li {
    padding: var(--space-2) 0 var(--space-2) var(--space-6);
    position: relative;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
    border-bottom: 1px solid var(--color-border-subtle);
}

.ingredients-list li:last-child { border-bottom: none; }

.ingredients-list li:before {
    content: "";
    position: absolute;
    left: var(--space-2);
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-primary);
    transform: translateY(-50%);
}

.instructions-text {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    margin: 0;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.dietary-tag {
    background: var(--color-primary-subtle);
    color: var(--color-primary);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    text-transform: capitalize;
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
    padding: var(--space-4);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-xl);
}

.page-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.page-btn:hover:not(:disabled) {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

.page-btn:disabled {
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

.page-info {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .header { padding: var(--space-6); }
    .header h1 { font-size: var(--text-2xl); }
    .search-section { padding: var(--space-4); }
    .search-bar { flex-direction: column; }
    .filters { grid-template-columns: 1fr 1fr; }
    .recipes-grid { grid-template-columns: 1fr; }
    .recipe-macros { grid-template-columns: repeat(2, 1fr); }

    .show-details-btn,
    .view-recipe-btn {
        min-height: 48px;
    }
}

@media (max-width: 480px) {
    .header h1 { font-size: var(--text-xl); }
    .search-section { padding: var(--space-3); }
    .filters { grid-template-columns: 1fr; }
    .recipe-name { font-size: var(--text-lg); }
}

/* ============================================================================
   Dark Mode Overrides
   ========================================================================= */

/* Select chevron: lighter grey so it's visible on dark input backgrounds */
[data-theme="dark"] .filter-group select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23A0A0A0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M4 6l4 4 4-4'/%3e%3c/svg%3e");
}
