/* Main Container */
.daf-form-container {
    max-width: 800px;
    margin: 40px auto;
    background: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333;
}

/* Sections */
.daf-section {
    margin-bottom: 40px;
}

.daf-section-title {
    font-size: 1.5em;
    font-weight: 700;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
    margin-bottom: 30px;
    color: #2c3e50;
    display: inline-block;
}

/* Form Table */
.daf-form-table {
    width: 100%;
    border-collapse: collapse;
    border-bottom: 1px solid #ddd;
    /* Ensure bottom border exists */
}

.daf-form-table th,
.daf-form-table td {
    padding: 20px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    /* Darker border */
    /* Fixed: Added border back */
    vertical-align: top;
}

/* Last child border removed to ensure all rows have borders */

.daf-form-table th {
    width: 30%;
    font-weight: 600;
    color: #555;
    padding-top: 25px;
    /* Align with input text */
}

/* Inputs and Selects */
.daf-form-table input[type="text"],
.daf-form-table input[type="email"],
.daf-form-table input[type="tel"],
.daf-form-table input[type="number"],
.daf-form-table select,
.daf-form-table textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 16px;
    background-color: #fcfcfc;
    transition: all 0.3s ease;
    color: #333;
}

.daf-form-table input:focus,
.daf-form-table select:focus,
.daf-form-table textarea:focus {
    background-color: #fff;
    border-color: #0073aa;
    box-shadow: 0 0 0 4px rgba(0, 115, 170, 0.1);
    outline: none;
}

.daf-form-table textarea {
    resize: vertical;
    min-height: 100px;
}

/* Required Badge */
.required {
    display: inline-block;
    color: #fff;
    font-size: 0.7em;
    margin-left: 8px;
    background: #e74c3c;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    vertical-align: middle;
    letter-spacing: 0.5px;
}

/* Date Field Grouping */
.daf-date-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.daf-date-group select {
    flex: 1;
    width: auto !important;
    /* Override 100% width */
}

/* Flex Row removed as fields are now split */

/* Item Accordion/Card Style */
.daf-item-row {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.3s ease;
}

.daf-item-row:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.daf-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 15px 20px;
    cursor: default;
    /* Changed from pointer */
    border-bottom: 1px solid #eee;
}

.daf-item-title {
    font-weight: 700;
    color: #2c3e50;
    font-size: 1.1em;
}

.daf-item-summary {
    font-size: 0.9em;
    color: #777;
    margin-left: 15px;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.daf-toggle-icon {
    display: none;
    /* Hidden */
}

.daf-remove-item {
    background: transparent;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
}

.daf-remove-item:hover {
    background: #e74c3c;
    color: #fff;
}

.daf-item-body {
    padding: 20px;
    display: block;
    /* Always visible */
}

/* Add Item Buttons */
.daf-add-item-wrapper {
    margin-top: 30px;
    text-align: center;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px dashed #ccc;
    display: flex;
    /* Flexbox for alignment */
    justify-content: center;
    gap: 10px;
    /* Space between buttons */
    flex-wrap: wrap;
    /* Allow wrapping on very small screens if absolutely necessary, but try to keep inline */
}

.button.secondary {
    background: #fff;
    border: 1px solid #0073aa;
    color: #0073aa;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.button.secondary:hover {
    background: #0073aa;
    color: #fff;
}

/* Image Upload */
.daf-image-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background-color: #fdfdfd;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
}

.daf-image-upload-label:hover {
    border-color: #0073aa;
    background-color: #f0f7fb;
    color: #0073aa;
}

.daf-image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.daf-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.daf-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.daf-remove-image {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Submit Section */
.daf-submit-section {
    margin-top: 40px;
    text-align: center;
}

.da-submit-button {
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: #fff;
    border: none;
    padding: 16px 50px;
    font-size: 1.2em;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 115, 170, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.da-submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.4);
}

.da-submit-button:active {
    transform: translateY(0);
}

/* Terms Checkbox Styling (Refined) */
.daf-terms-checkbox-wrapper {
    display: flex;
    align-items: center;
    background-color: #fff8e1;
    /* Softer yellow */
    border: 2px solid #ffc107;
    padding: 20px;
    border-radius: 8px;
    font-weight: bold;
    color: #5d4037;
    margin-top: 15px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.daf-terms-checkbox-wrapper:hover {
    background-color: #ffecb3;
    transform: scale(1.01);
}

.daf-terms-checkbox-wrapper input[type="checkbox"] {
    transform: scale(1.5);
    margin-right: 15px;
    accent-color: #ffc107;
}

.daf-terms-box {
    background: #f9f9f9;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #666;
}

.daf-terms-box ul {
    margin: 10px 0 0 20px;
    padding: 0;
}

/* Responsive */
@media (max-width: 600px) {
    .daf-form-container {
        padding: 15px 10px;
        /* Reduced horizontal padding */
        margin: 20px 0;
        /* Removed side margins */
        box-shadow: none !important;
        border: none !important;
    }

    .daf-form-table {
        border: none !important;
    }

    /* Force 16px font size to prevent zoom on iOS */
    .daf-form-table input[type="text"],
    .daf-form-table input[type="email"],
    .daf-form-table input[type="tel"],
    .daf-form-table input[type="number"],
    .daf-form-table select,
    .daf-form-table textarea {
        font-size: 16px !important;
    }

    /* Reset background for theme zebra striping and remove borders */
    .daf-form-table tr,
    .daf-form-table th,
    .daf-form-table td {
        background: transparent !important;
        background-color: transparent !important;
        border: none !important;
    }

    .daf-form-table th,
    .daf-form-table td {
        display: block;
        width: 100%;
        padding: 10px 0;
    }

    .daf-form-table th {
        padding-bottom: 5px;
        color: #333;
    }

    .daf-flex-row {
        flex-direction: column;
        gap: 10px;
    }

    .da-submit-button {
        width: 100%;
        padding: 15px;
    }

    .daf-item-header,
    .daf-item-body {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    /* Ensure buttons fit on one line on mobile */
    .daf-add-item-wrapper {
        flex-wrap: nowrap !important;
        /* Force single line */
        padding: 10px !important;
    }

    .daf-add-item-wrapper .button.secondary {
        padding: 8px 5px !important;
        /* Reduce padding significantly */
        font-size: 13px !important;
        /* Reduce font size */
        flex: 1;
        /* Distribute space equally */
        width: auto !important;
    }
}

/* Custom Validation Styling */
.daf-error-message {
    color: #e74c3c;
    font-size: 0.85em;
    margin-top: 5px;
    font-weight: bold;
    display: block;
}

.daf-input-error {
    border-color: #e74c3c !important;
    background-color: #fff8f8 !important;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1) !important;
}

/* Back Button Spacing */
#daf-back-btn {
    margin-right: 20px;
}

@media (max-width: 600px) {
    #daf-back-btn {
        margin-right: 0;
        margin-bottom: 20px;
    }
}

/* Assessment Summary Table */
.daf-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: #f9f9f9;
    border: 1px solid #eee;
}

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

.daf-summary-table th {
    background: #eaeaea;
    color: #333;
    font-weight: 600;
    width: 70%;
}

.daf-summary-table td {
    background: #fff;
    font-size: 1em;
}

.daf-summary-total {
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    padding: 15px;
    background: #eef7fc;
    border: 2px solid #0073aa;
    color: #0073aa;
    border-radius: 6px;
    margin-bottom: 20px;
}