/* Container Styling */
.aek-container {
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    width: 100%; /* Ensure the container takes full width */
    max-width: 100%; /* Prevent any max-width restrictions */
    margin: 0 auto; /* Center the container if needed */
    box-sizing: border-box; /* Include padding in width calculation */
}

.aek-form-container {
    width: 100%; /* Ensure the form container takes full width */
    max-width: 100%; /* Prevent any max-width restrictions */
    padding: 15px;
    box-sizing: border-box; /* Include padding in width calculation */
}

hr {
    border: 1px solid #F6F7FB;
    margin-bottom: 10px;
}

/* Form Row Styling */
.aek-form-row {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    width: 100%; /* Ensure form rows take full width */
    box-sizing: border-box; /* Include padding in width calculation */
}

/* Label Styling */
.aek-form-label {
    flex: 0 0 220px; /* Fixed width for labels */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-right: 20px;
    box-sizing: border-box; /* Include padding in width calculation */
}

.aek-form-label label {
    font-weight: bold;
    color: #FF6B3D;
    width: 100%;
}

/* Input Styling */
.aek-form-input,
.aek-input-container {
    flex: 1;
    min-width: 0;
    width: 100%;
    box-sizing: border-box; /* Include padding in width calculation */
}

.aek-form-input input[type="text"],
.aek-input-container input[type="text"],
.aek-input-container textarea,
.aek-form-textarea textarea {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    box-sizing: border-box;
    background-color: #EFF1F9;
}

.aek-form-input input[type="text"]:focus,
.aek-input-container input[type="text"]:focus,
.aek-form-textarea textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 61, 0.3);
}

/* Textarea Styling */
.aek-form-textarea textarea {
    width: 100%;
    min-height: 150px; /* Adjust as needed */
    resize: vertical;
}

/* Toggle Switch Styles */
.aek-toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.aek-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.aek-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.aek-toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.aek-toggle-switch input:checked + .aek-toggle-slider {
    background-color: #2196F3;
}

.aek-toggle-switch input:checked + .aek-toggle-slider:before {
    transform: translateX(26px);
}

/* Disabled Toggle Switch Styles */
.aek-toggle-switch input:disabled + .aek-toggle-slider {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.aek-toggle-switch input:disabled + .aek-toggle-slider:before {
    background-color: #f5f5f5;
}

/* Utility class for hiding elements */
.hidden {
    display: none;
}

/* Ensure the container stays hidden by default */
#aek_simple_content_container.hidden {
    display: none;
}

/* Ensure the textarea matches the width and styling of other inputs when visible */
#aek_simple_content_container {
    width: 100%; /* Ensure the container takes full width */
    box-sizing: border-box; /* Include padding in width calculation */
}

#aek_simple_content_container .aek-form-textarea {
    width: 100%; /* Ensure the textarea container takes full width */
    box-sizing: border-box; /* Include padding in width calculation */
}

#aek_simple_content_container .aek-form-textarea textarea {
    width: 100%; /* Ensure the textarea takes full width */
    padding: 10px; /* Match padding with other inputs */
    border: none; /* Match border style with other inputs */
    border-radius: 8px; /* Match border radius with other inputs */
    font-size: 16px; /* Match font size with other inputs */
    font-family: inherit; /* Match font family with other inputs */
    box-sizing: border-box; /* Include padding in width calculation */
    background-color: #EFF1F9; /* Match background color with other inputs */
    resize: vertical; /* Allow vertical resizing */
    min-height: 150px; /* Set a minimum height */
}

#aek_simple_content_container .aek-form-textarea textarea:focus {
    outline: none; /* Remove default focus outline */
    box-shadow: 0 0 0 3px rgba(255, 107, 61, 0.3); /* Match focus style with other inputs */
}

/* Mode Transition Animations */
#aek_detailed_fields,
#aek_simple_content_container {
    overflow: visible;
    width: 100%;
}

#aek_detailed_fields.with-transition,
#aek_simple_content_container.with-transition {
    opacity: 1;
    max-height: 2000px;
    visibility: visible;
    transition: opacity 0.3s ease-in-out, max-height 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

#aek_detailed_fields.with-transition.hidden,
#aek_simple_content_container.with-transition.hidden {
    opacity: 0;
    max-height: 0;
    visibility: hidden;
    margin: 0;
    padding: 0;
}

/* Button Container - Align Left */
.aek-button-container {
    display: flex;
    justify-content: flex-start; /* Move buttons to the left */
    align-items: center; /* Align buttons vertically */
    margin-top: 2rem;
    gap: 1rem; /* Reduce gap for better spacing */
    flex-wrap: wrap; /* Prevent overflow on smaller screens */
}

/* Buttons */
.aek-button-container button {
    padding: 10px 16px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

/* Primary Button */
.primary-button {
    background-color: #FF6B3D;
    color: white;
    border: none;
}

.primary-button:hover {
    background-color: #e05b32;
}

/* Ghost Button (Delete) */
.ghost-button {
    background-color: transparent;
    color: #FF6B3D;
    border: 2px solid #FF6B3D;
}

.ghost-button:hover {
    background-color: #FF6B3D;
    color: white;
}

/* Responsive Adjustments */
@media (max-width: 800px) {
    .aek-button-container {
        flex-direction: column; /* Stack buttons on smaller screens */
        align-items: flex-start; /* Align to left */
        gap: 0.5rem;
    }

    .aek-button-container button {
        width: 100%; /* Make buttons full width on smaller screens */
        text-align: center;
    }
    .page-content {
        width: 100%;
    }
}

/* Tooltip Styles */
.aek-tooltip {
    position: relative;
    display: inline-block;
    margin-left: 5px;
    vertical-align: middle;
    cursor: help;
}

.aek-tooltip .aek-tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 14px;
    line-height: 1.4;
}

.aek-tooltip:hover .aek-tooltiptext,
.aek-tooltip:focus .aek-tooltiptext,
.aek-tooltip:active .aek-tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Form Heading Styles */
.aek-form-heading {
    margin: 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.aek-form-heading h3 {
    margin: 0;
    color: #FF6B3D;
}

/* Dropdown Styles */
.aek-form-input select,
.aek-input-container select {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    background-color: #EFF1F9;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

.aek-form-input select:focus,
.aek-input-container select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 61, 0.3);
}

/* Style the asterisk for required fields */
.aek-required-label::after {
    content: ' *';
    color: red;
    font-weight: bold;
}

/* Red border and light red background for invalid fields */
.aek-input-error input,
.aek-input-error textarea,
.aek-input-error select {
    border-color: #dc3545 !important;
    background-color: #f8d7da !important;
}

/* Optional: Add an error message hint below the field */
.aek-error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 4px;
}

/* Responsive Styles */
@media (max-width: 800px) {
    .aek-form-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-content {
        width: 100%;
    }
    .aek-form-label {
        width: 100%;
        height: auto;
        padding-right: 0;
        margin-bottom: 5px;
    }

    .aek-form-input,
    .aek-form-input input[type="text"],
    .aek-input-container,
    .aek-input-container input[type="text"] {
        min-width: 0;
    }

    .aek-button-container {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    #aek_simple_content_container {
        padding: 10px;
        margin: 0 auto;
        width: 100%;
        margin-bottom: 15px;
    }

    #aek_simple_content_container .aek-form-textarea textarea {
        width: 100%;
        padding: 10px;
        box-sizing: border-box;
        min-height: 200px;
    }

    /* Optionally adjust toggle switch and font sizes if needed */
    .aek-toggle-switch {
        width: 50px;
        height: 28px;
    }

    .aek-toggle-slider:before {
        height: 22px;
        width: 22px;
        left: 3px;
        bottom: 3px;
    }
}

@media (max-width: 600px) {
    .aek-container {
        padding: 10px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
    }
    

    .aek-form-container {
        padding: 10px;
    }

    .aek-form-row {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 15px;
    }

    .aek-form-label {
        width: 100%;
        text-align: left;
        margin-bottom: 5px;
    }

    .aek-form-input input[type="text"],
    .aek-form-textarea textarea,
    .aek-input-container input[type="text"],
    .aek-input-container select {
        width: 100%;
        padding: 10px;
        box-sizing: border-box;
    }

    /* .aek-button-container {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    } */

    #aek_simple_content_container {
        padding: 10px;
        margin: 0 auto;
        width: 100%;
        margin-bottom: 15px;
    }

    #aek_simple_content_container .aek-form-textarea textarea {
        width: 100%;
        padding: 10px;
        box-sizing: border-box;
        min-height: 200px;
    }
}

@media (max-width: 768px) {
    .aek-button-container {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .aek-button-container button {
        width: 100%;
    }

    .aek-container {
        padding-bottom: 80px; /* prevent overlap with fixed footer/buttons */
    }
}

@media (max-width: 768px) {
    main.content {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .site-header {
        position: fixed;
        top: 0;
        z-index: 10;
        width: 100%;
    }

    .container {
        margin-top: 90px; /* compensate for fixed header */
    }
}