/* --- MODERN FORM SCSS-like CSS --- */
/* Uses WordPress CSS variables with fallbacks for theme independence */

.fangmeldung-bulk-wrapper {
    width: 100% !important;
    max-width: 800px !important;
    margin: 20px auto;
    /* Matches style.css exactly */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #333;
    /* Simple padding - small values that work everywhere */
    padding: 0 10px !important;
    box-sizing: border-box !important;
}

.fangmeldung-bulk-wrapper * {
    box-sizing: border-box !important;
}

.bulk-form-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    /* Soft modern shadow */
    padding: 30px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Prevent iOS Safari overflow */
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

/* Header */
.form-header {
    text-align: center;
    margin-bottom: 25px;
}

.form-header h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin: 0 0 5px 0;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header-icon {
    font-size: 1.8rem;
}

.form-subtitle {
    color: #7f8c8d;
    font-size: 1rem;
    margin: 0;
}

/* Alerts */
.fangmeldung-alert {
    padding: 15px;
    border-radius: 10px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 25px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.info-alert {
    background-color: #f0f7ff;
    border-left: 4px solid #0073aa;
    color: #005680;
}

.alert-icon {
    font-size: 1.2rem;
}

/* Grid Layout */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 100%;
    overflow: hidden;
}

.full-width {
    grid-column: 1 / -1;
}

.form-divider {
    height: 1px;
    background: #eee;
    margin: 10px 0;
    grid-column: 1 / -1;
}

/* Inputs */
.form-group {
    margin-bottom: 5px;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    overflow: hidden;
}

.form-label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #34495e;
    font-size: 0.95rem;
}

.form-control {
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    background: #fdfdfd;
    color: #2c3e50;
    /* Explicit dark text color for Firefox */
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
    box-sizing: border-box !important;
    min-width: 0;
}

/* Ensure dropdown options have dark text (Firefox fix) */
.form-control option,
.fangmeldung-bulk-wrapper select option {
    color: #2c3e50;
    background: #ffffff;
}

.form-control:focus {
    border-color: #0073aa;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
    outline: none;
}

.form-text {
    font-size: 0.85rem;
    color: #95a5a6;
    margin-top: 6px;
}

/* Input with Unit */
.input-with-unit {
    position: relative;
}

.unit-label {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-weight: 500;
    pointer-events: none;
}

/* Select Wrapper for custom arrow */
.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: "▼";
    font-size: 0.7rem;
    color: #999;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
}

/* Number Input with +/- Buttons */
.number-input-wrapper {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.number-input-wrapper .form-control {
    border: none;
    border-radius: 0;
    text-align: center;
    box-shadow: none;
    font-weight: bold;
}

.qty-btn {
    background: #f8f9fa;
    border: none;
    width: 44px;
    font-size: 1.2rem;
    cursor: pointer;
    color: #555;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: #e9ecef;
    color: #000;
}

.qty-btn:active {
    background: #dde2e6;
}

/* Date Time with Action */
.input-with-action {
    display: flex !important;
    flex-direction: column !important;
    /* Stack vertically */
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.input-with-action .form-control {
    width: 100% !important;
    min-width: 0;
    /* Important for flex */
}

.action-btn {
    background: #f1f3f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    height: 48px;
    /* Slightly taller for touch */
    width: 100% !important;
    /* Full width */
    max-width: 100% !important;
    padding: 0 20px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #0073aa;
    /* Use primary color for text button */
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box !important;
    min-width: 0;
}

.action-btn:hover {
    background: #e9ecef;
    border-color: #ccc;
}

/* Submit Button */
.form-actions {
    margin-top: 30px;
    text-align: center;
}

.submit-button {
    background: #0073aa;
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 115, 170, 0.3);
}

.submit-button:hover {
    background: #005177;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.4);
}

.submit-button:active {
    transform: translateY(0);
}

.submit-button:disabled {
    background: #a0a5aa;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Loader */
.btn-loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    display: none;
}

.submit-button.loading .btn-text,
.submit-button.loading .btn-icon {
    display: none;
}

.submit-button.loading .btn-loader {
    display: block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Form Message */
.form-message {
    margin-top: 20px;
    border-radius: 8px;
    padding: 0;
    transition: all 0.3s;
    overflow: hidden;
}

.form-message p {
    margin: 0;
    padding: 15px;
}

.form-message.success {
    background: #e7f7ed;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.form-message.error {
    background: #fdecea;
    color: #c62828;
    border: 1px solid #fad2cf;
}

/* Shake Animation for Error */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

/* Notes Textarea */
.textarea-wrapper {
    position: relative;
}

.notes-textarea {
    resize: vertical;
    min-height: 70px;
    max-height: 150px;
    font-family: inherit;
    padding-bottom: 25px;
    /* Space for counter */
}

.char-counter {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 0.8rem;
    color: #999;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
}

.char-counter.warning {
    color: #f59e0b;
}

.char-counter.limit {
    color: #dc2626;
    font-weight: 600;
}

/* --- RESPONSIVE BREAKPOINTS --- */
@media (max-width: 600px) {

    /* Reduce wrapper padding on very small screens to respect theme tight layout */
    .fangmeldung-bulk-wrapper {
        padding: 0 !important;
        /* Remove wrapper offset so card touches theme boundaries like catch-form */
    }

    .bulk-form-card {
        padding: 20px 10px;
        /* Minimal horizontal padding */
        border-radius: 12px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    }

    .form-grid {
        grid-template-columns: 1fr;
        /* Stack everything on mobile */
        gap: 15px;
    }

    .form-label {
        font-size: 0.9rem;
    }

    .submit-button {
        width: 100%;
        justify-content: center;
        padding: 15px;
    }

    .form-header h2 {
        font-size: 1.5rem;
    }

    .bulk-form-card {
        /* Reduce shadow to prevent overflow peeking */
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05) !important;
        margin-left: 2px !important;
        margin-right: 2px !important;
    }

    /* Improve touch targets */
    .qty-btn {
        width: 48px;
        height: 48px;
    }



    input[type="number"],
    input[type="date"],
    input[type="datetime-local"],
    select {
        font-size: 16px;
        /* Prevent Zoom on iOS */
        min-height: 48px;
        /* Standard Touch Target */
    }

    /* iOS Safari date/time input fix */
    .form-control[type="datetime-local"],
    .form-control[type="date"] {
        width: calc(100% - 2px) !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        min-width: 0;
        margin: 0 !important;
    }
}

/* iOS Safari specific fixes - only for width/overflow, NOT appearance */
@supports (-webkit-touch-callout: none) {

    /* Keep native datetime picker styling on iOS */
    .form-control[type="datetime-local"],
    .form-control[type="date"] {
        /* Do NOT use -webkit-appearance: none here! It breaks iOS native picker */
        width: calc(100% - 2px) !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        min-width: 0;
        margin: 0 !important;
        appearance: none;
        /* Added to match style.css success */
    }

    /* Ensure input container doesn't overflow */
    .input-with-action {
        max-width: 100%;
        overflow: visible;
        /* FIXED: Don't clip content */
    }
}