/* ========================================
   Espace Partenaire — Frontend Form
   ======================================== */

.ep-form-wrapper {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    box-sizing: border-box;
}

.ep-form-wrapper *,
.ep-form-wrapper *::before,
.ep-form-wrapper *::after {
    box-sizing: border-box;
}

.ep-form-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 24px 0;
    padding: 0 0 16px 0;
    color: #1d2327;
    border-bottom: 2px solid #f0f0f1;
}

/* ---- Form layout ---- */

.ep-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ---- Field cards ---- */

.ep-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 0;
    border-bottom: 1px solid #f0f0f1;
}

.ep-field:first-child {
    padding-top: 0;
}

.ep-field:last-of-type {
    border-bottom: none;
    padding-bottom: 8px;
}

/* ---- Labels ---- */

.ep-label {
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
    margin: 0;
    letter-spacing: -0.01em;
}

/* ---- Inputs, textareas, selects ---- */

.ep-input,
.ep-textarea,
.ep-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.5;
    color: #1d2327;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.ep-input:focus,
.ep-textarea:focus,
.ep-select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.12);
}

.ep-input::placeholder,
.ep-textarea::placeholder {
    color: #a0a0a0;
}

.ep-textarea {
    resize: vertical;
    min-height: 120px;
}

.ep-color-input {
    height: 44px;
    padding: 4px 8px;
    cursor: pointer;
}

/* ---- Checkbox & Radio ---- */

.ep-checkbox-label,
.ep-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    cursor: pointer;
    font-size: 15px;
    color: #1d2327;
}

.ep-radio-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ---- Image upload ---- */

.ep-image-upload {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ep-image-preview {
    position: relative;
    display: inline-block;
    max-width: 280px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    background: #fafafa;
}

.ep-preview-img {
    display: block;
    max-width: 100%;
    height: auto;
}

.ep-image-preview .ep-remove-image {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* ---- Gallery ---- */

.ep-gallery-upload {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ep-gallery-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ep-gallery-item {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    background: #fafafa;
}

.ep-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ep-gallery-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    transition: background 0.15s;
}

.ep-gallery-remove:hover {
    background: #dc3232;
}

/* ---- File upload ---- */

.ep-file-upload {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ep-file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #f9fafb;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.ep-file-link {
    flex: 1;
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
}

.ep-file-link:hover {
    text-decoration: underline;
}

.ep-file-input {
    font-size: 14px;
    color: #555;
}

.ep-upload-progress {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.ep-progress-bar {
    height: 100%;
    width: 100%;
}

.ep-progress-fill {
    height: 100%;
    width: 0%;
    background: #2271b1;
    border-radius: 3px;
    transition: width 0.3s;
}

/* ---- Buttons ---- */

.ep-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.5;
    font-family: inherit;
}

.ep-btn-primary {
    background: #2271b1;
    color: #fff;
}

.ep-btn-primary:hover {
    background: #135e96;
}

.ep-btn-primary:disabled {
    background: #a7c5de;
    cursor: not-allowed;
}

.ep-btn-secondary {
    background: #f6f7f7;
    color: #1d2327;
    border: 1px solid #d0d5dd;
}

.ep-btn-secondary:hover {
    background: #eaecee;
}

.ep-btn-danger {
    background: #dc3232;
    color: #fff;
}

.ep-btn-danger:hover {
    background: #b02828;
}

.ep-btn-small {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* ---- Form actions ---- */

.ep-form-actions {
    display: flex;
    gap: 12px;
    padding-top: 24px;
    margin-top: 8px;
    border-top: 2px solid #f0f0f1;
}

/* ---- Alerts ---- */

.ep-alert {
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}

.ep-alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.ep-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ---- Messages (no access / not logged in) ---- */

.ep-message {
    max-width: 720px;
    margin: 32px auto;
    padding: 20px 24px;
    border-radius: 10px;
    font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

.ep-message-info {
    background: #f0f6fc;
    color: #1d2327;
    border: 1px solid #72aee6;
}

.ep-message-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.ep-message-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ---- Login form ---- */

.ep-login-form {
    max-width: 400px;
    margin: 20px auto;
    padding: 24px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}

.ep-login-form label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 14px;
}

.ep-login-form input[type="text"],
.ep-login-form input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.ep-login-form input[type="submit"] {
    width: 100%;
    padding: 10px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.ep-login-form input[type="submit"]:hover {
    background: #135e96;
}

/* ---- Utility ---- */

.ep-hidden {
    display: none !important;
}

/* ---- Spinner ---- */

.ep-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ep-spin 0.6s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

@keyframes ep-spin {
    to { transform: rotate(360deg); }
}

/* ---- WP Editor inside form ---- */

.ep-field .wp-editor-wrap {
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    overflow: hidden;
}

.ep-field .wp-editor-tabs {
    padding: 2px 4px 0;
}

.ep-field .wp-editor-container {
    border: none;
}

.ep-field .mce-toolbar-grp,
.ep-field .quicktags-toolbar {
    border-bottom: 1px solid #e0e0e0;
    background: #f9fafb;
}

.ep-field .mce-edit-area iframe,
.ep-field .wp-editor-area {
    min-height: 150px;
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
    .ep-form-wrapper {
        padding: 20px 16px;
        margin: 0 8px;
        border-radius: 10px;
    }

    .ep-form-actions {
        flex-direction: column;
    }

    .ep-btn {
        width: 100%;
    }

    .ep-gallery-item {
        width: 70px;
        height: 70px;
    }
}
