/* General Mobile Styles */
body {
    -webkit-text-size-adjust: 100%; /* Prevent font scaling in landscape mode */
}

/* Recipe Comparison Modal Styles */
.comparison-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.metric-card h5 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

.metric-value {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.metric-difference {
    font-size: 12px;
    color: #64748b;
}

.cost-highlight.cheapest {
    color: #10b981;
}

.cost-highlight.expensive {
    color: #f59e0b;
}

.comparison-table-container {
    overflow-x: auto;
    margin-bottom: 24px;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.comparison-table th,
.comparison-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.comparison-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
}

.comparison-table tr.has-warnings {
    background: #fef2f2;
}

.recipe-cost-breakdown {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.recipe-cost-breakdown h5 {
    margin: 0 0 12px 0;
    color: #374151;
    font-size: 16px;
}

.ingredient-cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}

.ingredient-cost-item:last-child {
    border-bottom: none;
}

.ingredient-cost-item.total-cost {
    font-weight: 600;
    color: #374151;
    border-top: 2px solid #e2e8f0;
    margin-top: 8px;
    padding-top: 12px;
}

.missing-ingredients-warning {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 12px;
    margin: 12px 0;
}

.missing-ingredients-warning h6 {
    margin: 0 0 8px 0;
    color: #dc2626;
    font-size: 14px;
}

.missing-ingredient {
    color: #dc2626;
    font-size: 12px;
    margin-bottom: 4px;
}

.comparison-chart {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.comparison-chart h5 {
    margin: 0 0 16px 0;
    color: #374151;
    font-size: 16px;
}

.chart-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chart-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-bar-label {
    min-width: 120px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.chart-bar-container {
    flex: 1;
    height: 24px;
    background: #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    background: #3b82f6;
    border-radius: 12px;
    transition: width 0.6s ease-out;
}

.chart-bar-fill.cheapest {
    background: #10b981;
}

.chart-bar-fill.most-expensive {
    background: #f59e0b;
}

.chart-bar-value {
    min-width: 80px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    text-align: right;
}

.recipe-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.recipe-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.recipe-selector select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.comparison-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Ingredient detail modal header styling */
#ingredient-detail-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#ingredient-detail-modal .modal-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ingredient-edit-btn {
    order: 1;
}

#ingredient-detail-close-btn {
    order: 2;
}

/* Ingredient detail modal styling */
#ingredient-detail-modal .modal {
    width: 95%;
    max-width: 100%;
    height: 90%;
    max-height: 90%;
}

.ingredient-detail-container {
    padding: 10px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section-header h4 {
    font-size: 16px;
    margin-bottom: 10px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.detail-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.detail-value {
    color: #1f2937;
}

.recipe-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recipe-link {
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    text-decoration: none;
    color: #3b82f6;
    font-weight: 500;
}

.recipe-link:hover {
    background: #e5e7eb;
}

/* Responsive layout for the main dashboard */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        height: auto;
    }

    .column {
        width: 100% !important; /* Override inline styles */
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .column-resizer {
        display: none;
    }

    .list-header h2, .list-header h3 {
        font-size: 1.2rem;
    }

    /* Show recipe detail on mobile but make it responsive */
    .recipe-detail {
        display: block !important;
        min-height: 300px;
        padding: 15px;
    }

    .recipe-content {
        padding: 10px;
    }

    /* Adjust tables for smaller screens */
    #ingredient-table, #recipe-table, #custom-units-table, #custom-densities-table {
        font-size: 14px;
    }

    #ingredient-table th, #ingredient-table td,
    #recipe-table th, #recipe-table td {
        padding: 6px;
    }

    /* Make modals full-width on mobile */
    .modal {
        width: 95%;
        max-width: 100%;
        height: 95%;
        max-height: 100%;
    }

    .modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .modal-header-right {
        width: 100%;
        justify-content: flex-end;
    }
    
    .logout-btn {
        font-size: 12px;
        padding: 5px 8px;
    }

    /* Recipe comparison mobile styles */
    .comparison-metrics {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .metric-card {
        padding: 12px;
    }

    .metric-value {
        font-size: 16px;
    }

    .comparison-table {
        font-size: 12px;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 8px 6px;
    }

    .chart-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .chart-bar-label {
        min-width: auto;
        font-size: 12px;
    }

    .chart-bar-container {
        width: 100%;
        height: 20px;
    }

    .chart-bar-value {
        min-width: auto;
        font-size: 11px;
        text-align: left;
    }

    .recipe-selector-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .comparison-actions {
        flex-direction: column;
        gap: 8px;
    }

    /* Ingredient detail modal styling */
    #ingredient-detail-modal .modal {
        width: 95%;
        max-width: 100%;
        height: 90%;
        max-height: 90%;
    }

    .ingredient-detail-container {
        padding: 10px;
    }

    .detail-section {
        margin-bottom: 20px;
    }

    .detail-section-header h4 {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .detail-item {
        display: flex;
        flex-direction: column;
        margin-bottom: 10px;
    }

    .detail-label {
        font-weight: 600;
        color: #374151;
        margin-bottom: 4px;
    }

    .detail-value {
        color: #1f2937;
    }

    .recipe-links {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .recipe-link {
        padding: 8px 12px;
        background: #f3f4f6;
        border-radius: 6px;
        text-decoration: none;
        color: #3b82f6;
        font-weight: 500;
    }

    .recipe-link:hover {
        background: #e5e7eb;
    }
}

/* Smaller mobile devices */
@media (max-width: 480px) {
    .list-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ingredient-search-bar, .recipe-search-bar {
        flex-direction: column;
    }

    .ingredient-search-bar input, .recipe-search-bar input {
        width: calc(100% - 20px);
    }
    
    .login-container {
        padding: 20px;
    }

    .modal-body {
        padding: 10px;
    }

    .recipe-detail {
        min-height: 250px;
        padding: 10px;
    }

    /* Smaller ingredient detail modal */
    #ingredient-detail-modal .modal {
        width: 98%;
        height: 95%;
    }

    .ingredient-detail-container {
        padding: 5px;
    }

    .detail-section {
        margin-bottom: 15px;
    }

    .detail-section-header h4 {
        font-size: 14px;
    }

    /* Recipe comparison mobile styles */
    .comparison-metrics {
        gap: 8px;
    }

    .metric-card {
        padding: 8px;
    }

    .metric-value {
        font-size: 14px;
    }

    .comparison-table {
        font-size: 11px;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 6px 4px;
    }

    .recipe-cost-breakdown {
        padding: 12px;
    }

    .recipe-cost-breakdown h5 {
        font-size: 14px;
    }

    .ingredient-cost-item {
        font-size: 12px;
        padding: 6px 0;
    }
} 