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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #2d3748;
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    min-height: 100vh;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 50%, #4a5568 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 3px solid #f56565;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.logo i {
    color: #f56565;
    font-size: 2.25rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.admin-login-btn,
.add-recipe-btn {
    background: rgba(245, 101, 101, 0.2);
    border: 2px solid rgba(245, 101, 101, 0.4);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.admin-login-btn:hover,
.add-recipe-btn:hover {
    background: rgba(245, 101, 101, 0.3);
    border-color: rgba(245, 101, 101, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.3);
}

.admin-login-btn.admin-active {
    background: rgba(72, 187, 120, 0.3);
    border-color: rgba(72, 187, 120, 0.5);
    color: #68d391;
}

.admin-login-btn.admin-active:hover {
    background: rgba(72, 187, 120, 0.4);
    border-color: rgba(72, 187, 120, 0.7);
}

/* Main Content */
.main {
    padding: 2rem 0;
}

.hero {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero h2 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #f56565, #ed8936);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hero p {
    font-size: 1.5rem;
    color: #e2e8f0;
    font-weight: 400;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Filters */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.filter-group label {
    font-weight: 500;
    color: #4a5568;
    font-size: 0.9rem;
}

.filter-group select,
.search-group input {
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.filter-group select:focus,
.search-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-group {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-group i {
    position: absolute;
    right: 1rem;
    top: 2.25rem;
    color: #a0aec0;
}

/* Recipe Grid */
.recipe-count {
    text-align: center;
    margin: 1.5rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(245, 101, 101, 0.1), rgba(237, 137, 54, 0.1));
    border-radius: 15px;
    border: 1px solid rgba(245, 101, 101, 0.2);
}

.recipe-count span {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
}

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

.recipe-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid rgba(245, 101, 101, 0.2);
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.recipe-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #f56565, #ed8936, #f6ad55);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.recipe-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 50px rgba(245, 101, 101, 0.2);
    border-color: #f56565;
}

.recipe-card:hover::before {
    opacity: 1;
}

.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.recipe-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

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

.tag {
    background: rgba(245, 101, 101, 0.1);
    color: #e53e3e;
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(245, 101, 101, 0.2);
}

.badges {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.protein-badge {
    background: linear-gradient(135deg, #f56565, #e53e3e);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(245, 101, 101, 0.3);
}

.cost-badge {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(237, 137, 54, 0.3);
}

.recipe-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(245, 101, 101, 0.05), rgba(237, 137, 54, 0.05));
    border-radius: 15px;
    border: 1px solid rgba(245, 101, 101, 0.1);
}

.meta-item i {
    font-size: 1.5rem;
    color: #f56565;
    margin-bottom: 0.5rem;
}

.meta-value {
    font-weight: 700;
    color: #2d3748;
    font-size: 1.25rem;
}

.meta-label {
    font-size: 0.875rem;
    color: #4a5568;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recipe-preview {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.recipe-actions {
    display: flex;
    justify-content: center;
}

.view-recipe-btn {
    background: linear-gradient(135deg, #f56565, #e53e3e);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.view-recipe-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(245, 101, 101, 0.4);
    background: linear-gradient(135deg, #e53e3e, #c53030);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    color: #a0aec0;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #e53e3e;
}

.recipe-detail-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
}

.recipe-detail-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 1rem;
}

.recipe-detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.detail-meta-item {
    background: #f7fafc;
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
}

.detail-meta-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
    display: block;
}

.detail-meta-label {
    font-size: 0.875rem;
    color: #718096;
    margin-top: 0.25rem;
}

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

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

.recipe-section h4 i {
    color: #667eea;
}

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

.ingredients-list li {
    background: #f7fafc;
    margin-bottom: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

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

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #4a5568;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.submit-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
    width: 100%;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .header .container {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }

    .header-actions {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .admin-login-btn,
    .add-recipe-btn {
        width: 100%;
        justify-content: center;
    }

    .logo {
        font-size: 1.75rem;
    }

    .hero h2 {
        font-size: 2.5rem;
    }

    .hero p {
        font-size: 1.25rem;
    }

    .filters {
        grid-template-columns: 1fr;
        padding: 2rem;
        gap: 1.5rem;
    }

    .recipes-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .recipe-card {
        padding: 1.5rem;
    }

    .recipe-meta {
        grid-template-columns: repeat(2, 1fr);
    }

    .recipe-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .badges {
        align-items: flex-start;
        flex-direction: row;
        gap: 0.5rem;
    }

    .modal-content {
        margin: 2% auto;
        padding: 1.5rem;
        width: 95%;
    }

    .recipe-detail-meta {
        grid-template-columns: repeat(2, 1fr);
    }

    .recipe-detail-title {
        font-size: 1.75rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .nutrition-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .macro-percentages {
        flex-direction: column;
        gap: 0.5rem;
    }

    .recipe-detail-badges {
        justify-content: center;
    }

    .recipe-stats {
        justify-content: center;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .hero h2 {
        font-size: 2rem;
    }

    .recipe-meta {
        grid-template-columns: 1fr;
    }

    .recipe-detail-meta {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 2% auto;
        padding: 1rem;
        width: 98%;
    }

    .nutrition-grid {
        grid-template-columns: 1fr;
    }

    .macro-labels {
        flex-direction: column;
        gap: 0.5rem;
    }

    .macro-breakdown {
        padding: 0.75rem;
    }

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

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

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

/* Hide recipe cards by default for filtering */
.recipe-card.hidden {
    display: none;
}

/* Macro Breakdown Styles */
.macro-breakdown {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(245, 101, 101, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(245, 101, 101, 0.1);
}

.macro-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    margin-bottom: 0.75rem;
}

.macro-segment {
    height: 100%;
    transition: all 0.3s ease;
}

.macro-segment.protein {
    background: linear-gradient(90deg, #f56565, #e53e3e);
}

.macro-segment.carbs {
    background: linear-gradient(90deg, #ed8936, #dd6b20);
}

.macro-segment.fats {
    background: linear-gradient(90deg, #f6ad55, #ed8936);
}

.macro-labels {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.macro-label {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    color: white;
}

.macro-label.protein-label {
    background: rgba(245, 101, 101, 0.8);
}

.macro-label.carbs-label {
    background: rgba(237, 137, 54, 0.8);
}

.macro-label.fats-label {
    background: rgba(246, 173, 85, 0.8);
}

/* Admin Modal Styles */
.admin-modal {
    max-width: 500px;
}

.admin-login-form {
    margin-bottom: 2rem;
}

.admin-panel {
    padding-top: 2rem;
    border-top: 2px solid #e2e8f0;
}

.admin-actions {
    display: grid;
    gap: 1rem;
}

.admin-btn,
.admin-action-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-btn:hover,
.admin-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.admin-action-btn.logout {
    background: linear-gradient(135deg, #e53e3e, #c53030);
}

.admin-action-btn.logout:hover {
    box-shadow: 0 4px 15px rgba(229, 62, 62, 0.4);
}

/* Enhanced Form Styles */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.nutrition-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(245, 101, 101, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(245, 101, 101, 0.1);
}

.nutrition-section h4 {
    color: #e53e3e;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Recipe Detail Modal Enhancements */
.recipe-detail-badges {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.recipe-badge {
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
}

.recipe-badge.protein-badge {
    background: linear-gradient(135deg, #f56565, #e53e3e);
}

.recipe-badge.cost-badge {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
}

.recipe-badge.time-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.nutrition-overview {
    margin: 2rem 0;
    padding: 2rem;
    background: rgba(245, 101, 101, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(245, 101, 101, 0.1);
}

.nutrition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.nutrition-item {
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.nutrition-item:hover {
    border-color: rgba(245, 101, 101, 0.3);
    transform: translateY(-2px);
}

.nutrition-item.calories {
    border-color: rgba(245, 101, 101, 0.2);
}

.nutrition-item.protein {
    border-color: rgba(229, 62, 62, 0.2);
}

.nutrition-item.carbs {
    border-color: rgba(237, 137, 54, 0.2);
}

.nutrition-item.fats {
    border-color: rgba(246, 173, 85, 0.2);
}

.nutrition-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    display: block;
    margin-bottom: 0.25rem;
}

.nutrition-label {
    font-size: 0.875rem;
    color: #4a5568;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.macro-breakdown-detail {
    margin-top: 2rem;
}

.macro-bar-large {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    margin-bottom: 1rem;
}

.macro-percentages {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.macro-percent {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: white;
}

.macro-percent.protein-percent {
    background: rgba(245, 101, 101, 0.8);
}

.macro-percent.carbs-percent {
    background: rgba(237, 137, 54, 0.8);
}

.macro-percent.fats-percent {
    background: rgba(246, 173, 85, 0.8);
}

.recipe-stats {
    margin: 1.5rem 0;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #4a5568;
    font-weight: 500;
}

.stat-item i {
    color: #f56565;
}

.tag-detail {
    background: rgba(245, 101, 101, 0.1);
    color: #e53e3e;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid rgba(245, 101, 101, 0.2);
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    display: inline-block;
}

.recipe-tags-detail {
    margin: 1rem 0;
}