/* =====================================================
   FPDD Mail Sender — Styles
   ===================================================== */

.fms-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    max-width: 780px;
    margin: 24px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #2d3748;
}

.fms-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 24px;
    border-bottom: 2px solid #A0CE4E;
    background: linear-gradient(135deg, #f8fdf0 0%, #fff 100%);
    border-radius: 10px 10px 0 0;
}

.fms-card-icon {
    font-size: 22px;
    line-height: 1;
}

.fms-card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #2d3748;
    letter-spacing: -.3px;
}

.fms-card-body {
    padding: 28px 24px;
}

/* ── Champs ── */
.fms-field-group {
    margin-bottom: 20px;
}

.fms-label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #4a5568;
    margin-bottom: 6px;
    letter-spacing: .2px;
}

.fms-required {
    color: #e53e3e;
    margin-left: 2px;
    cursor: default;
}

.fms-field-hint {
    margin: 4px 0 0;
    font-size: 12px;
    color: #718096;
}

.fms-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border: 1.5px solid #cbd5e0;
    border-radius: 6px;
    font-size: 14px;
    color: #2d3748;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}

.fms-input:focus {
    border-color: #A0CE4E;
    box-shadow: 0 0 0 3px rgba(160,206,78,.18);
}

.fms-input.fms-error {
    border-color: #fc8181;
    box-shadow: 0 0 0 3px rgba(252,129,129,.18);
}

/* ── Tag input (destinataires / copie) ── */
.fms-tag-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border: 1.5px solid #cbd5e0;
    border-radius: 6px;
    background: #fff;
    cursor: text;
    min-height: 42px;
    transition: border-color .2s, box-shadow .2s;
}

.fms-tag-wrap:focus-within,
.fms-tag-wrap.fms-focused {
    border-color: #A0CE4E;
    box-shadow: 0 0 0 3px rgba(160,206,78,.18);
}

.fms-tag-wrap.fms-error {
    border-color: #fc8181;
    box-shadow: 0 0 0 3px rgba(252,129,129,.18);
}

.fms-tag-chips {
    display: contents;
}

.fms-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px 3px 10px;
    background: #EAF3DE;
    border: 1px solid #c6e09a;
    border-radius: 20px;
    font-size: 13px;
    color: #3d6b10;
    white-space: nowrap;
    max-width: 260px;
}

.fms-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fms-chip-remove {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 14px;
    color: #6b8c30;
    line-height: 1;
    display: flex;
    align-items: center;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    justify-content: center;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}

.fms-chip-remove:hover {
    background: #c6e09a;
    color: #2d5a0a;
}

.fms-tag-text {
    border: none;
    outline: none;
    flex: 1;
    min-width: 180px;
    font-size: 13px;
    color: #2d3748;
    background: transparent;
    padding: 2px 0;
}

.fms-tag-text::placeholder {
    color: #a0aec0;
}

/* ── Éditeur riche ── */
.fms-editor-wrap {
    border: 1.5px solid #cbd5e0;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
}

.fms-editor-wrap:focus-within {
    border-color: #A0CE4E;
    box-shadow: 0 0 0 3px rgba(160,206,78,.18);
}

.fms-editor-wrap.fms-error {
    border-color: #fc8181;
    box-shadow: 0 0 0 3px rgba(252,129,129,.18);
}

.fms-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 6px 10px;
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
}

.fms-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #4a5568;
    transition: background .15s, border-color .15s, color .15s;
    line-height: 1;
}

.fms-tb-btn:hover {
    background: #EAF3DE;
    border-color: #A0CE4E;
    color: #2d5a0a;
}

.fms-tb-btn.active {
    background: #A0CE4E;
    border-color: #87b83a;
    color: #fff;
}

.fms-tb-sep {
    width: 1px;
    height: 20px;
    background: #e2e8f0;
    margin: 0 4px;
}

.fms-tb-select {
    height: 28px;
    padding: 0 6px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    color: #4a5568;
    background: #fff;
    cursor: pointer;
    outline: none;
}

.fms-tb-select:focus {
    border-color: #A0CE4E;
}

.fms-editor {
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.7;
    color: #2d3748;
    background: #fff;
    outline: none;
}

.fms-editor:empty::before {
    content: attr(data-placeholder);
    color: #a0aec0;
    pointer-events: none;
}

.fms-editor ul,
.fms-editor ol {
    padding-left: 22px;
    margin: 8px 0;
}

.fms-editor a {
    color: #378ADD;
}

/* ── Boutons d'action ── */
.fms-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    gap: 12px;
}

.fms-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, box-shadow .2s, opacity .2s;
    text-decoration: none;
    line-height: 1.3;
}

.fms-btn--primary {
    background: #4a9c39;
    color: #fff;
    box-shadow: 0 2px 6px rgba(74,156,57,.25);
}

.fms-btn--primary:hover {
    background: #3d8730;
    box-shadow: 0 4px 10px rgba(74,156,57,.3);
}

.fms-btn--primary:disabled {
    opacity: .6;
    cursor: not-allowed;
    box-shadow: none;
}

.fms-btn--secondary {
    background: #fff;
    color: #718096;
    border: 1.5px solid #cbd5e0;
}

.fms-btn--secondary:hover {
    background: #f7fafc;
    border-color: #a0aec0;
    color: #4a5568;
}

/* ── Statut ── */
.fms-status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fms-status--success {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #276749;
}

.fms-status--error {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #9b2c2c;
}

.fms-status--loading {
    background: #ebf8ff;
    border: 1px solid #90cdf4;
    color: #2c5282;
}

/* ── Notice non connecté ── */
.fms-notice {
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 14px;
}

.fms-notice--warn {
    background: #fffbeb;
    border: 1px solid #f6e05e;
    color: #744210;
}

/* ── Spinner ── */
@keyframes fms-spin {
    to { transform: rotate(360deg); }
}

.fms-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(44,82,130,.3);
    border-top-color: #2c5282;
    border-radius: 50%;
    animation: fms-spin .7s linear infinite;
    flex-shrink: 0;
}

/* ── Responsive ── */
@media (max-width: 540px) {
    .fms-card-body { padding: 18px 14px; }
    .fms-actions { flex-direction: column; }
    .fms-btn { width: 100%; justify-content: center; }
}
