/* Recipe Editor Page Styles
 * @version 2.0.0
 * @changelog
 *   2.0.0 - Added tablet (768px) and mobile (430px) responsive breakpoints.
 *            Full-width stacked buttons on mobile, 16px inputs to prevent iOS zoom,
 *            interpretation mode toggle wraps gracefully, translate controls stack vertically.
 *   1.0.0 - Initial release.
 */

.recipe-editor {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
}

.recipe-editor h1 {
    color: #c84a31;
    font-size: 32px;
    margin-bottom: 10px;
}

.recipe-editor-subtitle {
    color: #666;
    margin-bottom: 30px;
}

.editor-form {
    background: white;
    padding: 30px;
    border: 2px solid #c84a31;
    border-radius: 8px;
}

.image-upload-section {
    background: #f8f9fa;
    border: 2px dashed #c84a31;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    text-align: center;
}

.image-upload-section h3 {
    color: #c84a31;
    margin: 0 0 15px 0;
    font-size: 20px;
}

.image-upload-section p {
    color: #666;
    margin-bottom: 15px;
    font-size: 14px;
}

.image-preview {
    max-width: 400px;
    margin: 15px auto;
    border: 2px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.upload-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #c84a31;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
}

.upload-btn:hover {
    background: #a63a25;
}

.upload-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.upload-status {
    margin-top: 15px;
    padding: 12px;
    border-radius: 4px;
    font-size: 14px;
}

.upload-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.upload-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.upload-status.processing {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
    font-size: 16px;
}

.form-group .help-text {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    font-style: italic;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

.form-group textarea {
    min-height: 150px;
    line-height: 1.6;
    resize: vertical;
}

.form-group input[type="text"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #c84a31;
    box-shadow: 0 0 0 3px rgba(200, 74, 49, 0.1);
}

.required {
    color: #d63638;
}

.error-messages {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.error-messages ul {
    margin: 10px 0 0 20px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #eee;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #00a32a;
    color: white;
}

.btn-primary:hover {
    background: #008a20;
}

.btn-secondary {
    background: #666;
    color: white;
}

.btn-secondary:hover {
    background: #444;
}

.btn-danger {
    background: #d63638;
    color: white;
    margin-left: auto;
}

.btn-danger:hover {
    background: #b32d2e;
}

.tip-box {
    background: #f0f8ff;
    border-left: 4px solid #0073aa;
    padding: 12px 15px;
    margin-top: 8px;
    font-size: 13px;
}

.tip-box strong {
    color: #0073aa;
}

/* ============================================================
   TABLET — max-width: 768px
   ============================================================ */
@media (max-width: 768px) {

    .recipe-editor {
        margin: 20px auto;
    }

    .recipe-editor h1 {
        font-size: 26px;
    }

    .editor-form {
        padding: 20px;
    }

    .image-upload-section {
        padding: 20px 15px;
    }

    .form-actions {
        flex-wrap: wrap;
    }
}

/* ============================================================
   MOBILE — max-width: 430px (iPhone 16 and all current iPhones)
   ============================================================ */
@media (max-width: 430px) {

    /* --- Page layout --- */
    .recipe-editor {
        margin: 10px auto;
        padding: 0 12px;
    }

    .recipe-editor h1 {
        font-size: 22px;
        margin-bottom: 6px;
    }

    .recipe-editor-subtitle {
        font-size: 14px;
        margin-bottom: 20px;
    }

    /* --- Tab buttons --- */
    .tab-btn {
        padding: 10px 14px;
        font-size: 13px;
        margin-right: 3px;
    }

    /* --- Import sections --- */
    .image-upload-section {
        padding: 15px 12px;
        text-align: left;
    }

    .image-upload-section h3 {
        font-size: 17px;
    }

    .text-import-section {
        padding: 0;
    }

    /* --- Upload/action buttons: full width and stacked --- */
    .upload-btn {
        display: block;
        width: 100%;
        box-sizing: border-box;
        margin-left: 0 !important;
        margin-bottom: 8px;
        padding: 14px;
        font-size: 15px;
        text-align: center;
    }

    /* Interpretation mode toggle: wrap text gracefully */
    #imageInterpretToggle label,
    #textInterpretMode + span {
        font-size: 13px;
    }

    #imageInterpretToggle p {
        font-size: 11px;
    }

    /* Translate container: stack select + button vertically */
    #translateContainer,
    #editTranslateContainer {
        flex-direction: column;
        align-items: stretch !important;
    }

    #translateContainer select,
    #editTranslateContainer select,
    #translateContainer button,
    #editTranslateContainer button {
        width: 100%;
        box-sizing: border-box;
    }

    /* --- Editor form --- */
    .editor-form {
        padding: 15px 12px;
        border-radius: 6px;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .form-group label {
        font-size: 15px;
    }

    .form-group input[type="text"],
    .form-group select,
    .form-group textarea {
        padding: 10px;
        font-size: 16px; /* prevents iOS auto-zoom on focus */
    }

    .form-group textarea {
        min-height: 120px;
    }

    /* --- Form actions: stack all buttons full width --- */
    .form-actions {
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
        padding-top: 20px;
    }

    .btn {
        width: 100%;
        padding: 14px;
        font-size: 16px;
        box-sizing: border-box;
    }

    .btn-danger {
        margin-left: 0;
    }

    /* Image preview: full width on mobile */
    .image-preview {
        max-width: 100%;
    }

    /* Tip boxes: slightly smaller */
    .tip-box {
        font-size: 12px;
        padding: 10px 12px;
    }
}