/**
 * Campaign Dashboard Styles
 * Seamless white design matching Auctioneer dashboard
 * Uses same CSS variables from msa-front.css when available
 */

/* ===== Layout ===== */
.ec-dashboard {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 0;
    font-family: 'Montserrat', -apple-system, sans-serif;
    color: var(--msa-text, #333);
}

/* ===== Header ===== */
.ec-dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 0;
    box-shadow: none;
}

.ec-dash-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 2px;
    color: var(--msa-text, #333);
}

.ec-dash-welcome {
    color: var(--msa-text-light, #666);
    font-size: 0.85rem;
}

.ec-dash-signout {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--msa-text-light, #666);
    text-decoration: none;
    transition: color 0.2s;
}

.ec-dash-signout:hover {
    color: var(--msa-text, #333);
}

/* ===== Tabs ===== */
.ec-dash-tabs {
    display: flex;
    gap: 0;
    background: transparent;
    border: none;
    border-bottom: none;
    padding: 0;
    overflow-x: auto;
}

.ec-dash-tab {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 10px 16px 10px 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--msa-text-light, #666);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    box-shadow: none;
}

.ec-dash-tab:hover {
    color: var(--msa-text, #333);
    background: transparent;
}

.ec-dash-tab:focus,
.ec-dash-tab:focus-visible,
.ec-dash-tab:active {
    background: transparent;
    outline: none;
    box-shadow: none;
    border: none;
}

.ec-dash-tab.active {
    color: var(--msa-text, #333);
    font-weight: 700;
    background: transparent;
}

/* ===== Panels ===== */
.ec-dash-panel {
    display: none;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 24px 0;
    box-shadow: none;
}

.ec-dash-panel.active {
    display: block;
}

/* ===== Section Headers ===== */
.ec-dash-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.ec-dash-section-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--msa-text, #333);
}

/* ===== Buttons ===== */
.ec-dash-btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    background: #f0f0f0;
    color: var(--msa-text, #333);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.ec-dash-btn:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

.ec-dash-btn:active {
    transform: translateY(0);
}

.ec-dash-btn-primary {
    background: var(--msa-gold, #C9AC8C);
    color: #fff;
    border-color: var(--msa-gold, #C9AC8C);
}

.ec-dash-btn-primary:hover {
    background: var(--msa-gold-dark, #b89a7a);
    color: #fff;
}

.ec-dash-btn-success {
    background: var(--msa-green, #4CAF50);
    color: #fff;
}

.ec-dash-btn-success:hover {
    background: #388E3C;
    color: #fff;
}

.ec-dash-btn-warning {
    background: #dba617;
    color: #fff;
}

.ec-dash-btn-warning:hover {
    background: #c29412;
    color: #fff;
}

.ec-dash-btn-danger {
    background: none;
    color: var(--msa-red, #e74c3c);
    border: 1px solid var(--msa-red, #e74c3c);
}

.ec-dash-btn-danger:hover {
    background: var(--msa-red, #e74c3c);
    color: #fff;
}

.ec-dash-btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.ec-dash-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===== Tables ===== */
.ec-dash-table-wrap {
    overflow-x: auto;
}

.ec-dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.ec-dash-table th {
    text-align: left;
    padding: 10px 12px 10px 0;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--msa-text-light, #666);
    border-bottom: 1px solid #e0e0e0;
}

.ec-dash-table td {
    padding: 12px 12px 12px 0;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.ec-dash-table tbody tr:hover {
    background: transparent;
}

.ec-dash-empty {
    text-align: center;
    color: #999;
    padding: 40px 8px !important;
}

.ec-dash-campaign-name {
    cursor: pointer;
    color: var(--msa-gold-dark, #b89a7a);
    font-weight: 600;
}

.ec-dash-campaign-name:hover {
    text-decoration: underline;
}

.ec-dash-campaign-subject {
    font-size: 0.8rem;
    color: #999;
    margin-top: 2px;
}

.ec-dash-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    white-space: nowrap;
}

/* ===== Status Badges ===== */
.ec-dash-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ec-dash-status-draft {
    background: #f0f0f1;
    color: #50575e;
}

.ec-dash-status-sending {
    background: #fff8e1;
    color: #f57f17;
}

.ec-dash-status-completed {
    background: var(--msa-green-light, #e8f5e9);
    color: #2e7d32;
}

.ec-dash-status-sent {
    background: var(--msa-green-light, #e8f5e9);
    color: #2e7d32;
}

.ec-dash-status-failed {
    background: #fce4ec;
    color: #c62828;
}

.ec-dash-status-pending {
    background: #f0f0f1;
    color: #50575e;
}

/* ===== Stats ===== */
.ec-dash-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0;
    margin: 16px 0;
}

.ec-dash-stat-card {
    background: transparent;
    border: none;
    border-right: 1px solid #f0f0f0;
    border-radius: 0;
    padding: 20px 16px;
    text-align: center;
}

.ec-dash-stat-card:last-child {
    border-right: none;
}

.ec-dash-stat-card .ec-dash-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--msa-text, #333);
}

.ec-dash-stat-card .ec-dash-stat-label {
    font-size: 0.8rem;
    color: var(--msa-text-light, #666);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* ===== Info Grid ===== */
.ec-dash-info-grid {
    display: grid;
    gap: 8px;
    margin-bottom: 20px;
}

.ec-dash-info-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.85rem;
}

.ec-dash-info-label {
    flex: 0 0 140px;
    font-weight: 600;
    color: var(--msa-text-light, #666);
}

.ec-dash-info-value {
    flex: 1;
}

/* ===== Forms ===== */
.ec-dash-form-row {
    margin-bottom: 16px;
}

.ec-dash-form-row label {
    display: block;
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 4px;
    color: var(--msa-text, #333);
}

.ec-dash-form-row input[type="text"],
.ec-dash-form-row input[type="email"],
.ec-dash-form-row input[type="url"],
.ec-dash-form-row input[type="date"],
.ec-dash-form-row select {
    width: 100%;
    padding: 10px 0;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.88rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
    background: transparent;
}

.ec-dash-form-row textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.88rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
    background: transparent;
}

.ec-dash-form-row input:focus,
.ec-dash-form-row select:focus {
    outline: none;
    border-bottom-color: var(--msa-gold, #C9AC8C);
    box-shadow: none;
}

.ec-dash-form-row textarea:focus {
    outline: none;
    border-color: var(--msa-gold, #C9AC8C);
    box-shadow: none;
}

/* ===== WP Editor on Frontend ===== */
.ec-dash-form-row .wp-editor-wrap {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.ec-dash-form-row .wp-editor-wrap .mce-toolbar-grp {
    background: #f8f8f8;
}

.ec-dash-form-row .wp-editor-wrap .wp-editor-area {
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.ec-dash-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.ec-dash-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.ec-dash-hint {
    font-size: 0.8rem;
    color: var(--msa-text-light, #666);
    margin-top: 4px;
}

.ec-dash-char-count {
    font-size: 0.8rem;
    color: #999;
}

/* ===== Upload Area ===== */
.ec-dash-upload-area {
    border: 2px dashed #e0e0e0;
    border-radius: var(--msa-radius, 8px);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    min-height: 80px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ec-dash-upload-area:hover,
.ec-dash-upload-area.ec-dash-upload-dragover {
    border-color: var(--msa-gold, #C9AC8C);
    background: transparent;
}

.ec-dash-upload-prompt {
    color: var(--msa-text-light, #666);
    font-size: 0.85rem;
}

.ec-dash-upload-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 4px;
}

.ec-dash-upload-single .ec-dash-img-thumb {
    width: 100%;
    max-width: 300px;
    height: auto;
}

.ec-dash-img-thumb {
    position: relative;
    display: inline-block;
    border-radius: 6px;
    overflow: hidden;
    border: none;
}

.ec-dash-img-thumb img {
    width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: contain;
    display: block;
}

.ec-dash-img-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s;
}

.ec-dash-img-remove:hover {
    background: var(--msa-red, #e74c3c);
}

/* ===== Recipients ===== */
.ec-dash-radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.ec-dash-radio-group label {
    font-weight: 400;
    font-size: 0.85rem;
    cursor: pointer;
}

.ec-dash-recipient-section {
    margin-top: 8px;
}

.ec-dash-info-box {
    padding: 12px;
    background: #f0f6fc;
    border-left: 3px solid #0073aa;
    border-radius: 2px;
    font-size: 0.85rem;
}

.ec-dash-product-search {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.ec-dash-product-search input[type="text"] {
    width: auto;
    flex: 1;
    max-width: 300px;
}

.ec-dash-product-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 8px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.ec-dash-product-list label {
    display: block;
    padding: 4px 0;
    border-bottom: 1px solid #f5f5f5;
    font-weight: 400;
    font-size: 0.85rem;
    cursor: pointer;
}

.ec-dash-product-list .ec-dash-product-badge {
    display: inline-block;
    background: var(--msa-gold, #C9AC8C);
    color: #fff;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.7rem;
    margin-left: 4px;
}

.ec-dash-inline-check {
    font-weight: 400 !important;
    font-size: 0.85rem;
    white-space: nowrap;
}

.ec-dash-block-check {
    display: block;
    font-weight: 400;
    font-size: 0.85rem;
    margin: 4px 0;
}

.ec-dash-preview-recipients {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
    padding: 8px;
    background: #fff8e5;
    border-left: 3px solid #ffb900;
    border-radius: 2px;
}

/* ===== Modals ===== */
.ec-dash-modal {
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ec-dash-modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 460px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.ec-dash-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    background: none;
    border: none;
    line-height: 1;
}

.ec-dash-modal-close:hover {
    color: var(--msa-text, #333);
}

/* ===== Preview Modal ===== */
.ec-dash-modal-preview {
    max-width: 780px;
    width: 95%;
    padding: 24px 24px 16px;
}

.ec-dash-preview-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.ec-dash-preview-toggle .ec-dash-btn-sm.active {
    background: #333;
    color: #fff;
}

.ec-dash-preview-frame-wrap {
    background: #e8e8e8;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    justify-content: center;
    transition: padding 0.3s ease;
}

.ec-dash-preview-frame {
    width: 100%;
    max-width: 700px;
    height: 70vh;
    border: none;
    border-radius: 4px;
    background: #fff;
    transition: max-width 0.3s ease;
}

.ec-dash-preview-mobile .ec-dash-preview-frame {
    max-width: 375px;
}

/* ===== Progress Bar ===== */
.ec-dash-progress-bar-wrap {
    background: #e0e0e0;
    border-radius: 4px;
    height: 24px;
    overflow: hidden;
    margin: 12px 0;
}

.ec-dash-progress-bar {
    background: linear-gradient(90deg, var(--msa-gold, #C9AC8C), var(--msa-gold-dark, #b89a7a));
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
}

.ec-dash-progress-stats {
    display: flex;
    gap: 20px;
    margin: 12px 0;
    font-size: 0.85rem;
}

.ec-dash-progress-warning {
    font-size: 0.8rem;
    color: var(--msa-red, #e74c3c);
    font-weight: 600;
    margin: 8px 0;
}

.ec-dash-send-progress {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid #eee;
    border-radius: 4px;
}

/* ===== Inline Send Progress ===== */
.ec-dash-send-inline {
    margin-top: 20px;
    padding: 16px 20px;
    border: 2px solid var(--msa-gold, #C9AC8C);
    border-radius: 8px;
    background: #fdfbf8;
}

.ec-dash-send-inline-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.ec-dash-send-inline-header strong {
    font-size: 1rem;
}

.ec-dash-send-done strong {
    color: #27ae60;
}

.ec-dash-send-inline-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* ===== Status Tab ===== */
.ec-dash-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.ec-dash-status-card {
    padding: 16px;
    border: 1px solid #eee;
    border-radius: 6px;
    text-align: center;
}

.ec-dash-status-ok {
    border-color: var(--msa-green-light, #e8f5e9);
    background: #fafffe;
}

.ec-dash-status-warn {
    border-color: #fcf9e8;
    background: #fffdf5;
}

.ec-dash-status-icon {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.ec-dash-status-ok .ec-dash-status-icon {
    color: var(--msa-green, #4CAF50);
}

.ec-dash-status-warn .ec-dash-status-icon {
    color: #dba617;
}

.ec-dash-status-label {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.ec-dash-status-detail {
    font-size: 0.8rem;
    color: var(--msa-text-light, #666);
}

/* ===== Back Button ===== */
.ec-dash-back-btn {
    margin-bottom: 12px;
}

/* ===== Toast ===== */
.ec-dash-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    border-radius: var(--msa-radius, 8px);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    color: #fff;
    background: var(--msa-text, #333);
    z-index: 100001;
    transform: translateY(100px);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    pointer-events: none;
    max-width: 400px;
}

.ec-dash-toast.ec-dash-toast-visible {
    transform: translateY(0);
    opacity: 1;
}

.ec-dash-toast.ec-dash-toast-error {
    background: var(--msa-red, #e74c3c);
}

.ec-dash-toast.ec-dash-toast-success {
    background: var(--msa-green, #4CAF50);
}

/* ===== Detail View ===== */
.ec-dash-detail h2 {
    font-size: 1.2rem;
    margin: 8px 0 16px;
}

/* ===== Responsive ===== */
@media screen and (max-width: 768px) {
    .ec-dashboard {
        padding: 10px 0;
    }

    .ec-dash-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .ec-dash-tab {
        padding: 10px 14px;
        font-size: 0.82rem;
    }

    .ec-dash-panel {
        padding: 16px 0;
    }

    .ec-dash-form-grid {
        grid-template-columns: 1fr;
    }

    .ec-dash-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .ec-dash-stat-card {
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
    }

    .ec-dash-radio-group {
        flex-direction: column;
        gap: 8px;
    }

    .ec-dash-table {
        font-size: 0.8rem;
    }

    .ec-dash-table th,
    .ec-dash-table td {
        padding: 8px 6px 8px 0;
    }

    .ec-dash-table th:nth-child(5),
    .ec-dash-table td:nth-child(5),
    .ec-dash-table th:nth-child(6),
    .ec-dash-table td:nth-child(6) {
        display: none;
    }

    .ec-dash-status-grid {
        grid-template-columns: 1fr;
    }

    .ec-dash-product-search {
        flex-wrap: wrap;
    }

    .ec-dash-toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
}

@media (max-width: 480px) {
    .ec-dash-stats {
        grid-template-columns: 1fr;
    }
}

/* ===== Login/Notice ===== */
.ec-dash-login-required,
.ec-dash-notice {
    padding: 20px;
    text-align: center;
}

.ec-dash-notice-error {
    color: var(--msa-red, #e74c3c);
}
