/* ============================================================
   Espace Commerçant — ADCAP
   Style front-end de l'interface de publication
   ============================================================ */

.ec-wrap {
    max-width: 780px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    color: #1a1a2e;
    line-height: 1.5;
}

/* ============================================================
   EN-TÊTE
   ============================================================ */

.ec-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(135deg, #1a3a5c 0%, #2563a8 100%);
    color: #fff;
    padding: 20px 24px;
    border-radius: 14px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(26, 58, 92, 0.25);
}

.ec-header-inner {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ec-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.ec-welcome {
    margin: 0 0 3px;
    font-size: 17px;
    font-weight: 700;
}

.ec-commerce-name {
    margin: 0;
    font-size: 13px;
    opacity: 0.85;
}

.ec-logout {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 7px 16px;
    border-radius: 20px;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ec-logout:hover {
    color: #fff;
    border-color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

/* ============================================================
   ALERTES
   ============================================================ */

.ec-alert {
    padding: 13px 18px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
}

.ec-alert-success {
    background: #f0fdf4;
    color: #14532d;
    border-color: #86efac;
}

.ec-alert-error {
    background: #fff1f2;
    color: #881337;
    border-color: #fda4af;
}

/* ============================================================
   CARTES
   ============================================================ */

.ec-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 14px;
    padding: 26px 28px;
    margin-bottom: 20px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
}

.ec-card-title {
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 22px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f3f4f6;
}

/* ============================================================
   FORMULAIRE
   ============================================================ */

.ec-form {}

.ec-field {
    margin-bottom: 20px;
}

.ec-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.ec-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 7px;
}

.ec-required {
    color: #ef4444;
    margin-left: 1px;
}

.ec-hint {
    font-weight: 400;
    color: #9ca3af;
    font-size: 12px;
    margin-left: 4px;
}

.ec-input,
.ec-select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: #fff;
    transition: border-color 0.18s, box-shadow 0.18s;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.ec-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.ec-input:focus,
.ec-select:focus {
    outline: none;
    border-color: #2563a8;
    box-shadow: 0 0 0 3px rgba(37, 99, 168, 0.12);
}

/* ---- Éditeur ---- */

.ec-editor-wrap {
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid #d1d5db;
}

.ec-editor-wrap .wp-editor-container {
    border: none !important;
}

/* ---- Zone de drop image ---- */

.ec-file-drop {
    position: relative;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    background: #fafafa;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    min-height: 90px;
}

.ec-file-drop:hover,
.ec-file-drop.is-over {
    border-color: #2563a8;
    background: #eff6ff;
}

.ec-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.ec-file-label {
    padding: 24px 20px;
    text-align: center;
    pointer-events: none;
}

.ec-file-icon {
    display: block;
    font-size: 26px;
    margin-bottom: 8px;
}

.ec-file-text {
    font-size: 13px;
    color: #6b7280;
}

.ec-file-link {
    color: #2563a8;
    font-weight: 600;
    text-decoration: underline;
}

.ec-image-preview {
    padding: 14px;
    text-align: center;
    background: #f9fafb;
    position: relative;
    z-index: 1;
}

.ec-image-preview img {
    max-height: 180px;
    max-width: 100%;
    border-radius: 8px;
    object-fit: cover;
    display: block;
    margin: 0 auto 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.ec-remove-image {
    background: #fee2e2;
    color: #991b1b;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.ec-remove-image:hover {
    background: #fecaca;
}

.ec-current-image {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.ec-current-image img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}

/* ---- Pied de formulaire ---- */

.ec-form-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding-top: 18px;
    border-top: 1px solid #f3f4f6;
    margin-top: 6px;
}

.ec-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.18s ease;
    line-height: 1;
}

.ec-btn-primary {
    background: #2563a8;
    color: #fff;
}

.ec-btn-primary:hover {
    background: #1a4a88;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37, 99, 168, 0.35);
    color: #fff;
}

.ec-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.ec-btn-secondary:hover {
    background: #e9eaed;
    color: #374151;
}

/* ============================================================
   LISTE DES ARTICLES
   ============================================================ */

.ec-articles-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ec-article-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 14px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #f0f1f3;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.ec-article-item:hover {
    border-color: #e2e4e8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.ec-article-trashed {
    opacity: 0.45;
    pointer-events: none;
}

/* Miniature */
.ec-article-thumb {
    width: 54px;
    height: 54px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #e9eaed;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ec-article-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ec-article-no-thumb {
    font-size: 20px;
}

/* Infos article */
.ec-article-info {
    flex: 1;
    min-width: 0;
}

.ec-article-title {
    margin: 0 0 5px;
    font-weight: 600;
    font-size: 14px;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ec-article-meta {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: #6b7280;
}

/* Badges statut */
.ec-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.ec-badge-published { background: #dcfce7; color: #166534; }
.ec-badge-scheduled { background: #dbeafe; color: #1e40af; }
.ec-badge-expired   { background: #fee2e2; color: #991b1b; }
.ec-badge-draft     { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }
.ec-badge-deleted   { background: #fee2e2; color: #991b1b; }

.ec-expired-tag { color: #dc2626; font-weight: 500; }

/* Actions article */
.ec-article-actions {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-shrink: 0;
}

.ec-icon-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    font-size: 14px;
    text-decoration: none;
    background: #fff;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    padding: 0;
}

.ec-icon-btn:hover { transform: scale(1.08); }
.ec-icon-edit:hover  { background: #eff6ff; border-color: #bfdbfe; }
.ec-icon-view:hover  { background: #f0fdf4; border-color: #bbf7d0; }
.ec-icon-delete:hover { background: #fff1f2; border-color: #fda4af; }

/* ============================================================
   NOTICES
   ============================================================ */

.ec-notice {
    padding: 16px 20px;
    border-radius: 10px;
    font-size: 14px;
}

.ec-notice-warn  { background: #fefce8; border: 1px solid #fde68a; color: #78350f; }
.ec-notice-error { background: #fff1f2; border: 1px solid #fda4af; color: #881337; }

.ec-empty {
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
    padding: 24px 0 8px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 620px) {
    .ec-wrap    { padding: 12px 12px 40px; }
    .ec-card    { padding: 18px 16px; }
    .ec-header  { flex-direction: column; align-items: flex-start; }

    .ec-field-row { grid-template-columns: 1fr; }

    .ec-article-item { gap: 10px; }
    .ec-article-thumb { width: 44px; height: 44px; }

    .ec-form-footer { flex-direction: column; align-items: stretch; }
    .ec-btn         { justify-content: center; }
}
