/* Casa del Lievito - Recipes Manager - Frontend Styles */

.cdl-my-recipes {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.cdl-my-recipes h2 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #333;
}

.cdl-recipes-tabs {
    margin-bottom: 30px;
}

.cdl-recipes-tabs ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #ddd;
}

.cdl-recipes-tabs li {
    margin: 0;
}

.cdl-recipes-tabs a {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.cdl-recipes-tabs a:hover {
    color: #333;
}

.cdl-recipes-tabs a.active {
    color: #d32f2f;
    border-bottom-color: #d32f2f;
}

.cdl-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.cdl-tab-content.active {
    display: block;
}

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

.cdl-recipes-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    margin-bottom: 20px;
}

.cdl-recipe-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 850px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
    overflow: hidden;
}

.cdl-recipe-card.cdl-hidden {
    display: none !important;
}

.cdl-recipe-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.cdl-recipe-thumb {
    width: 180px !important;
    max-width: 26% !important;
    height: 120px !important;
    flex-shrink: 0 !important;
    position: relative;
    overflow: hidden;
}

.cdl-recipe-thumb img,
.cdl-recipe-thumb .cdl-card-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.cdl-recipe-body {
    padding: 10px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

.cdl-recipe-body h3 {
    margin-top: 0;
    margin-bottom: 4px;
    font-size: 20px;
    line-height: 1.2;
    color: #d32f2f;
}

.cdl-recipe-body h3 a {
    text-decoration: none;
    color: #d32f2f;
}

.cdl-recipe-categories {
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.cdl-recipe-actions {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    margin-top: 4px;
}

.cdl-recipe-actions .button {
    background-color: #d32f2f;
    color: #fff;
    border: none;
    padding: 4px 6px;
    font-size: 11px;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s;
    flex: 1 1 0;
    text-align: center;
    min-width: 0;
}

.cdl-recipe-actions .button:hover {
    background-color: #b71c1c;
}

.cdl-recipe-actions a,
.cdl-recipe-actions button {
    max-width: 120px;
}

.post-type-archive-cdl_recipe .cdl-recipe-actions a,
.post-type-archive-cdl_recipe .cdl-recipe-actions button {
    max-width: 220px;
    min-height: 35px;
}

.post-type-archive-cdl_recipe .cdl-recipe-actions a {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cdl-modal-overlay {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
}

.cdl-modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.cdl-modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    position: relative;
}

.cdl-personal-recipe-modal {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
}

.cdl-personal-recipe-loading {
    text-align: center;
    padding: 40px 0;
    font-style: italic;
}

@media (max-width: 600px) {
    .cdl-recipe-card .cdl-recipe-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .cdl-recipe-card .cdl-recipe-actions .button,
    .cdl-recipe-card .cdl-recipe-actions a.button,
    .cdl-recipe-card .cdl-recipe-actions button.button {
        width: 100%;
        text-align: center;
    }
}

#cdl-add-recipe-modal .cdl-modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
}

#cdl-add-recipe-modal .cdl-form-group {
    margin-bottom: 15px;
}

#cdl-add-recipe-modal .cdl-form-group label {
    display: block;
    margin-bottom: 5px;
}

#cdl-add-recipe-modal input[type="text"],
#cdl-add-recipe-modal input[type="number"],
#cdl-add-recipe-modal textarea {
    width: 100%;
    box-sizing: border-box;
}

.cdl-ingredients-section h3 {
    margin-top: 20px;
    margin-bottom: 10px;
}

#cdl-ingredients-container .cdl-ingredient-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

#cdl-ingredients-container .cdl-ingredient-row input[type="text"],
#cdl-ingredients-container .cdl-ingredient-row input[type="number"] {
    flex: 1;
}

#cdl-ingredients-container .cdl-ingredient-row .cdl-remove-ingredient-row {
    flex: 0 0 auto;
}

.cdl-ingredients-section .cdl-add-ingredient-row {
    margin-top: 10px;
}

.cdl-form-actions {
    margin-top: 20px;
    text-align: right;
}

.cdl-modal-close {
    float: right;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

/* Calculator Modal Styles */
.cdl-calculator-modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 9999; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}

.cdl-calculator-modal.active {
    display: block;
}

.cdl-calculator-result {
    margin-top: 1em;
}

.cdl-calculator-trigger {
    margin-top: 2em;
}

.cdl-calculator-content {
    background-color: #fefefe;
    margin: 10% auto; /* 10% from the top and centered */
    padding: 20px;
    border: 1px solid #888;
    width: 80%; /* Could be more or less, depending on screen size */
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.cdl-calculator-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.cdl-calculator-close:hover,
.cdl-calculator-close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Table styles inside calculator */
#cdl-ingredients-list table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

#cdl-ingredients-list th, 
#cdl-ingredients-list td {
    padding: 8px;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

#cdl-desired-weight {
    padding: 8px;
    margin-right: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .cdl-recipe-card {
        flex-direction: column !important;
    }

    .cdl-recipe-thumb {
        width: 100% !important;
        max-width: 100% !important;
        height: 200px !important;
    }

    .cdl-recipe-body {
        width: 100%;
        padding: 15px;
    }
}
