/* Meal Planner Plugin Styles */

/* Recipe Card */
.meal-planner-recipe-card {
    max-width: 800px;
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.meal-planner-recipe-card .recipe-image img {
    width: 100%;
    height: auto;
}

.meal-planner-recipe-card .recipe-content {
    padding: 20px;
}

.meal-planner-recipe-card .recipe-title {
    font-size: 24px;
    margin-bottom: 10px;
}

.meal-planner-recipe-card .recipe-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.meal-planner-recipe-card .recipe-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.meal-planner-recipe-card .recipe-favorite {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px; /* Ensure consistent width */
}

.meal-planner-recipe-card .favorite-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 28px; /* Increased from 24px */
    line-height: 1;
    transition: transform 0.2s ease;
    outline: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px; /* Match height with stars */
}

.meal-planner-recipe-card .favorite-toggle .heart-icon {
    display: block;
    color: #ccc;
    transition: color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.meal-planner-recipe-card .favorite-toggle:hover {
    transform: scale(1.1);
}

.meal-planner-recipe-card .favorite-toggle:hover .heart-icon {
    color: #ff4b4b;
}

.meal-planner-recipe-card .favorite-toggle.active .heart-icon {
    color: #ff4b4b !important;
}

/* Ensure active state persists */
.meal-planner-recipe-card .favorite-toggle.active:hover .heart-icon {
    color: #ff4b4b !important;
}

/* Disable hover effect when processing */
.meal-planner-recipe-card .favorite-toggle[style*="pointer-events: none"] {
    transform: none;
}

.meal-planner-recipe-card .favorite-toggle[style*="pointer-events: none"] .heart-icon {
    opacity: 0.7;
}

.meal-planner-recipe-card .recipe-rating {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    position: relative;
}

.meal-planner-recipe-card .recipe-rating .rating-top {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.meal-planner-recipe-card .recipe-rating .star {
    color: #e4e5e9;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s ease-in-out;
}

.meal-planner-recipe-card .recipe-rating .star.filled {
    color: #ffd700;
}

.meal-planner-recipe-card .recipe-rating .star:hover,
.meal-planner-recipe-card .recipe-rating .star:hover ~ .star {
    color: #ffed4a;
}

.meal-planner-recipe-card .recipe-rating .stars[data-rating-mode="display"] .star {
    cursor: default;
}

.meal-planner-recipe-card .recipe-rating .stars[data-rating-mode="display"] .star:hover {
    color: #e4e5e9;
}

.meal-planner-recipe-card .recipe-rating .stars[data-rating-mode="display"] .star.filled:hover {
    color: #ffd700;
}

.meal-planner-recipe-card .recipe-rating .rating-count {
    font-size: 14px;
    color: #666;
    margin-left: 8px;
}

.meal-planner-recipe-card .recipe-rating .rating-success {
    color: #4CAF50;
    font-size: 14px;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.meal-planner-recipe-card .recipe-rating .rating-success.show {
    opacity: 1;
}

.meal-planner-recipe-card .print-recipe {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.meal-planner-recipe-card .recipe-details,
.meal-planner-recipe-card .recipe-times {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

/* Nutrition Section Styles */
.meal-planner-recipe-card .recipe-nutrition-section {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.meal-planner-recipe-card .recipe-nutrition-section h3 {
    color: #333;
    font-size: 1.2em;
    margin-bottom: 15px;
    text-align: center;
}

.meal-planner-recipe-card .nutrition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    justify-content: center;
}

.meal-planner-recipe-card .nutrition-item {
    background: white;
    border-radius: 10px;
    padding: 15px 10px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}

.meal-planner-recipe-card .nutrition-item:hover {
    transform: translateY(-2px);
}

.meal-planner-recipe-card .nutrition-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.meal-planner-recipe-card .nutrition-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #2c3e50;
    margin: 5px 0;
}

.meal-planner-recipe-card .nutrition-label {
    font-size: 0.9em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meal-planner-recipe-card .nutrition-note {
    text-align: center;
    color: #666;
    font-size: 0.9em;
    margin-top: 15px;
    font-style: italic;
}

/* Nutrition item specific colors */
.meal-planner-recipe-card .nutrition-item.calories {
    border-bottom: 3px solid #ff6b6b;
}

.meal-planner-recipe-card .nutrition-item.protein {
    border-bottom: 3px solid #4ecdc4;
}

.meal-planner-recipe-card .nutrition-item.carbs {
    border-bottom: 3px solid #ffd93d;
}

.meal-planner-recipe-card .nutrition-item.fat {
    border-bottom: 3px solid #95a5a6;
}

.meal-planner-recipe-card .nutrition-item.fiber {
    border-bottom: 3px solid #6c5ce7;
}

.meal-planner-recipe-card .nutrition-item.sugar {
    border-bottom: 3px solid #fd79a8;
}

/* Responsive adjustments for nutrition section */
@media (max-width: 768px) {
    .meal-planner-recipe-card .nutrition-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .meal-planner-recipe-card .nutrition-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.meal-planner-recipe-card .recipe-ingredients,
.meal-planner-recipe-card .recipe-instructions {
    margin-top: 20px;
}

.meal-planner-recipe-card .recipe-ingredients ul,
.meal-planner-recipe-card .recipe-instructions ol {
    padding-left: 20px;
}

.meal-planner-recipe-card .recipe-video {
    margin-top: 20px;
}

.meal-planner-recipe-card .recipe-video .video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.meal-planner-recipe-card .recipe-video .video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Recipe Archive */
.meal-planner-recipe-archive.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.meal-planner-recipe-archive .recipe-card {
    background-color: #fff;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.meal-planner-recipe-archive .recipe-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.meal-planner-recipe-archive .recipe-card h3 {
    font-size: 18px;
    margin: 10px;
}

.meal-planner-recipe-archive .recipe-card p {
    font-size: 14px;
    margin: 0 10px 10px;
}

.meal-planner-recipe-archive .recipe-card .view-recipe {
    display: block;
    text-align: center;
    background-color: #4CAF50;
    color: white;
    padding: 5px 0;
    text-decoration: none;
}

/* User Dashboard */
.meal-planner-user-dashboard {
    max-width: 1200px;
    margin: 0 auto;
}

.meal-planner-user-dashboard h2 {
    font-size: 28px;
    margin-bottom: 20px;
}

.meal-planner-user-dashboard h3 {
    font-size: 22px;
    margin-top: 30px;
    margin-bottom: 15px;
}

.meal-planner-user-dashboard .grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.meal-planner-user-dashboard .recipe-card {
    background-color: #fff;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.meal-planner-user-dashboard .recipe-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.meal-planner-user-dashboard .recipe-card h4 {
    font-size: 16px;
    margin: 10px;
}

.meal-planner-user-dashboard .recipe-card .view-recipe,
.meal-planner-user-dashboard .recipe-card .remove-favorite {
    display: block;
    text-align: center;
    background-color: #4CAF50;
    color: white;
    padding: 5px 0;
    text-decoration: none;
    margin-top: 5px;
}

.meal-planner-user-dashboard .recipe-card .remove-favorite {
    background-color: #f44336;
}

.meal-planner-user-dashboard .user-meal-plan {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.meal-planner-user-dashboard .meal-plan-day {
    background-color: #f5f5f5;
    padding: 10px;
    border-radius: 8px;
}

.meal-planner-user-dashboard .meal-plan-day h4 {
    font-size: 16px;
    margin-bottom: 10px;
}

.meal-planner-user-dashboard .meal {
    margin-bottom: 10px;
}

.meal-planner-user-dashboard .meal h5 {
    font-size: 14px;
    margin-bottom: 5px;
}

.meal-planner-user-dashboard .meal a {
    color: #4CAF50;
    text-decoration: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .meal-planner-user-dashboard .user-meal-plan {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .meal-planner-user-dashboard .user-meal-plan {
        grid-template-columns: 1fr;
    }
}

.meal-planner-favorites.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.meal-planner-favorites .recipe-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s ease;
}

.meal-planner-favorites .recipe-card:hover {
    transform: translateY(-5px);
}

.meal-planner-favorites .recipe-image {
    position: relative;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
}

.meal-planner-favorites .recipe-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.meal-planner-favorites .recipe-content {
    padding: 15px;
}

.meal-planner-favorites .recipe-content h3 {
    margin: 0 0 10px;
    font-size: 18px;
    line-height: 1.3;
}

.meal-planner-favorites .recipe-content p {
    margin: 0 0 15px;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.meal-planner-favorites .recipe-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.meal-planner-favorites .view-recipe {
    display: inline-block;
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.meal-planner-favorites .view-recipe:hover {
    background-color: #45a049;
}

/* Responsive Design */
@media (max-width: 768px) {
    .meal-planner-favorites.grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 480px) {
    .meal-planner-favorites.grid {
        grid-template-columns: 1fr;
    }
}

/* Modal Styles */
.meal-planner-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.meal-planner-modal-overlay.active {
    display: flex;
}

.meal-planner-modal {
    background: white;
    border-radius: 8px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.meal-planner-modal .close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    transition: color 0.2s ease;
}

.meal-planner-modal .close-modal:hover {
    color: #333;
}

.meal-planner-modal h2 {
    margin: 0 0 20px;
    font-size: 24px;
    color: #333;
}

.meal-planner-modal .tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.meal-planner-modal .tab {
    padding: 10px 20px;
    cursor: pointer;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

.meal-planner-modal .tab.active {
    color: #4CAF50;
    border-bottom-color: #4CAF50;
}

.meal-planner-modal .tab-content {
    display: none;
}

.meal-planner-modal .tab-content.active {
    display: block;
}

.meal-planner-modal form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.meal-planner-modal .form-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.meal-planner-modal label {
    font-weight: 600;
    color: #333;
}

.meal-planner-modal input[type="email"],
.meal-planner-modal input[type="password"] {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.meal-planner-modal input[type="email"]:focus,
.meal-planner-modal input[type="password"]:focus {
    border-color: #4CAF50;
    outline: none;
}

.meal-planner-modal button[type="submit"] {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.meal-planner-modal button[type="submit"]:hover {
    background: #45a049;
}

.meal-planner-modal .error-message {
    color: #f44336;
    font-size: 14px;
    margin-top: 10px;
    display: none;
}

.meal-planner-modal .error-message.show {
    display: block;
}

/* Ingredients Table Styles */
.ingredients-table-container {
    width: 100%;
    overflow-x: auto;
    margin: 1.5em 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ingredients-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin: 0;
}

.ingredients-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.ingredients-table .ingredient-group-header td {
    background-color: #f0f2f5;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    font-size: 1em;
    letter-spacing: 0.5px;
    padding-top: 15px;
    padding-bottom: 15px;
    border-top: 2px solid #e0e0e0;
}

.ingredients-table .ingredient-row:hover {
    background-color: #f8f9fa;
}

.ingredients-table .amount-unit {
    width: 20%;
    white-space: nowrap;
}

.ingredients-table .amount {
    text-align: right;
    display: inline-block;
    margin-right: 4px;
}

.ingredients-table .unit {
    display: inline-block;
}

.ingredients-table .ingredient {
    width: 50%;
}

.ingredients-table .notes {
    width: 30%;
    color: #666;
    font-style: italic;
}

/* Responsive Table Styles */
@media screen and (max-width: 768px) {
    .ingredients-table tbody, 
    .ingredients-table tr, 
    .ingredients-table td {
        display: block;
        width: 100%;
    }
    
    .ingredients-table tr {
        margin-bottom: 15px;
        border: 1px solid #eee;
        border-radius: 8px;
        overflow: hidden;
    }
    
    .ingredients-table td {
        text-align: right;
        padding: 10px 15px;
        position: relative;
        border-bottom: 1px solid #eee;
    }
    
    .ingredients-table td:last-child {
        border-bottom: none;
    }
    
    .ingredients-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        font-weight: 600;
        color: #333;
    }

    .ingredients-table .amount-unit {
        width: auto;
    }
    
    .ingredients-table .amount-unit::before {
        content: "Amount";
    }
    
    .ingredients-table .ingredient-group-header td {
        text-align: left;
        background-color: #f0f2f5;
    }
    
    .ingredients-table .ingredient-group-header td::before {
        display: none;
    }
    
    .ingredients-table td.ingredient,
    .ingredients-table td.notes {
        width: auto;
    }
    
    .ingredients-table td:empty {
        display: none;
    }
}

/**
 * Recipe Import Styles
 */
.mp-meta-box #mp-recipe-import-container {
    padding: 10px 0;
}

.mp-meta-box #mp-recipe-import-text {
    font-family: monospace;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    min-height: 200px;
}

.mp-meta-box .mp-import-actions {
    margin: 15px 0;
}

.mp-meta-box #mp-recipe-import-status {
    font-style: italic;
    display: inline-block;
    margin-left: 10px;
}

.mp-meta-box #mp-recipe-import-results {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 15px;
    margin-top: 15px;
}

.mp-meta-box #mp-recipe-import-ingredient-warnings {
    margin-top: 15px;
    padding: 10px;
    background: #fffde7;
    border-left: 3px solid #ffc107;
}

.mp-meta-box #mp-recipe-import-ingredient-warnings-list li {
    margin-bottom: 5px;
}