/**
 * Marketing Modules CSS
 * Blog, Instagram Creator, Google Ads
 */

/* ── Module Container ───────────────────────────────────────────── */
.marketing-module {
    padding: 0;
}

.marketing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.marketing-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.marketing-subtitle {
    font-size: 0.85rem;
    color: #64748b;
    display: block;
    margin-top: 0.15rem;
}

.marketing-header-right {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn-marketing {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-primary-mkt {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}
.btn-primary-mkt:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary-mkt:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary-mkt {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}
.btn-secondary-mkt:hover { background: #e2e8f0; }

.btn-mkt-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    color: #64748b;
    font-size: 0.9rem;
    transition: all 0.15s;
}
.btn-mkt-icon:hover { background: #f1f5f9; color: #334155; }
.btn-mkt-danger:hover { background: #fef2f2; color: #dc2626; }

/* ── Stats Row ──────────────────────────────────────────────────── */
.marketing-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.mkt-stat-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.85rem;
    text-align: center;
}

.mkt-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.mkt-stat-label {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.15rem;
}

/* ── Tabs ───────────────────────────────────────────────────────── */
.marketing-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1rem;
}

.mkt-tab {
    padding: 0.65rem 1.25rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.mkt-tab:hover { color: #334155; }
.mkt-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* ── Badges ─────────────────────────────────────────────────────── */
.mkt-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.mkt-badge-gray { background: #f1f5f9; color: #64748b; }
.mkt-badge-green { background: #dcfce7; color: #16a34a; }
.mkt-badge-blue { background: #dbeafe; color: #2563eb; }
.mkt-badge-yellow { background: #fef3c7; color: #d97706; }
.mkt-badge-purple { background: #ede9fe; color: #7c3aed; }
.mkt-badge-red { background: #fef2f2; color: #dc2626; }

/* ── List ───────────────────────────────────────────────────────── */
.mkt-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mkt-list-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.15s;
    gap: 1rem;
}
.mkt-list-item:hover { border-color: #667eea; box-shadow: 0 2px 8px rgba(102,126,234,0.1); }

.mkt-list-item-main { flex: 1; min-width: 0; }

.mkt-list-item-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
}

.mkt-list-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: #64748b;
    align-items: center;
}

.mkt-list-item-excerpt {
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 0.35rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.mkt-list-item-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.mkt-list-item-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

/* ── Keywords ───────────────────────────────────────────────────── */
.mkt-kw-tag {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 500;
}
.mkt-kw-negative { background: #fef2f2; color: #dc2626; text-decoration: line-through; }
.mkt-kw-high { background: #dcfce7; color: #16a34a; border-left: 3px solid #16a34a; }
.mkt-kw-medium { background: #fef3c7; color: #d97706; border-left: 3px solid #d97706; }

/* ── Empty / Loading / Error ────────────────────────────────────── */
.mkt-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}
.mkt-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}
.mkt-empty h3 {
    font-size: 1.1rem;
    color: #64748b;
    margin-bottom: 0.5rem;
}
.mkt-empty p { font-size: 0.85rem; }

.mkt-loading {
    text-align: center;
    padding: 2rem;
    color: #64748b;
    font-size: 0.9rem;
}

.mkt-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* ── Modal ──────────────────────────────────────────────────────── */
.mkt-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    animation: mktFadeIn 0.15s;
}

@keyframes mktFadeIn { from { opacity: 0; } to { opacity: 1; } }

.mkt-modal-content {
    background: white;
    border-radius: 14px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.mkt-modal-lg { max-width: 650px; }
.mkt-modal-xl { max-width: 850px; }

.mkt-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}
.mkt-modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mkt-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
    padding: 0;
}
.mkt-modal-close:hover { color: #334155; }

.mkt-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.mkt-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid #e2e8f0;
}

/* ── Form Elements ──────────────────────────────────────────────── */
.mkt-form-group {
    margin-bottom: 0.85rem;
}
.mkt-form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.3rem;
}

.mkt-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.mkt-input, .mkt-select, .mkt-textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.mkt-input:focus, .mkt-select:focus, .mkt-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.mkt-textarea { resize: vertical; min-height: 60px; }

.mkt-form-inline {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}
.mkt-form-inline .mkt-input { flex: 1; }

/* ── Ideas ──────────────────────────────────────────────────────── */
.mkt-ideas-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.mkt-idea-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    gap: 0.75rem;
}

.mkt-idea-content { flex: 1; min-width: 0; }
.mkt-idea-topic { font-weight: 500; font-size: 0.9rem; color: #1e293b; }
.mkt-idea-notes { display: block; font-size: 0.78rem; color: #64748b; margin-top: 0.15rem; }
.mkt-idea-actions { display: flex; gap: 0.25rem; }

/* ── Blog Post Preview ──────────────────────────────────────────── */
.blog-post-meta-bar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.85rem;
    margin-bottom: 1rem;
}
.blog-meta-item {
    font-size: 0.82rem;
    color: #475569;
    margin-bottom: 0.4rem;
    line-height: 1.5;
}
.blog-meta-item:last-child { margin-bottom: 0; }
.blog-meta-item strong { color: #1e293b; margin-right: 0.35rem; }
.blog-meta-item small { color: #94a3b8; margin-left: 0.35rem; }

.blog-post-preview {
    padding: 1rem;
    line-height: 1.75;
    color: #334155;
    font-size: 0.9rem;
}
.blog-post-preview h2 { color: #1e293b; font-size: 1.2rem; margin: 1.25rem 0 0.5rem; }
.blog-post-preview h3 { color: #334155; font-size: 1.05rem; margin: 1rem 0 0.35rem; }
.blog-post-preview p { margin-bottom: 0.75rem; }
.blog-post-preview ul, .blog-post-preview ol { padding-left: 1.5rem; margin-bottom: 0.75rem; }
.blog-post-preview li { margin-bottom: 0.35rem; }

/* ── Instagram Grid ─────────────────────────────────────────────── */
.insta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.85rem;
}

.insta-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.15s;
}
.insta-card:hover { border-color: #E4405F; box-shadow: 0 2px 8px rgba(228,64,95,0.1); }

.insta-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid #f1f5f9;
}
.insta-card-date { font-size: 0.72rem; color: #94a3b8; }

.insta-card-body {
    padding: 0.85rem;
    min-height: 80px;
}
.insta-card-caption {
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.5;
    margin: 0;
}

.insta-card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.25rem;
    padding: 0.5rem 0.85rem;
    border-top: 1px solid #f1f5f9;
}

/* ── Instagram Preview ──────────────────────────────────────────── */
.insta-preview {
    max-width: 400px;
    margin: 0 auto;
}

.insta-preview-phone {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: white;
}
.insta-preview-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid #efefef;
}
.insta-preview-image {
    aspect-ratio: 1;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.insta-preview-caption {
    padding: 0.85rem;
    font-size: 0.82rem;
    color: #262626;
    line-height: 1.5;
}

.insta-preview-hint {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #fef3c7;
    border-radius: 8px;
    font-size: 0.82rem;
    color: #92400e;
}

/* ── Google Ads Detail ──────────────────────────────────────────── */
.gads-detail-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.gads-detail-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.gads-metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
}

.gads-metric {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.65rem;
    text-align: center;
}
.gads-metric-val { display: block; font-size: 1.2rem; font-weight: 700; color: #1e293b; }
.gads-metric-label { display: block; font-size: 0.7rem; color: #64748b; margin-top: 0.15rem; }

.gads-headlines, .gads-descriptions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.gads-headline-item, .gads-desc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    font-size: 0.85rem;
}
.gads-headline-chars, .gads-desc-chars {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-left: 0.5rem;
    white-space: nowrap;
}

.gads-keywords-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.gads-kw-groups {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.gads-kw-group h4 {
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ── Dashboard Marketing Section ────────────────────────────────── */
.dash-marketing-section {
    margin-top: 1rem;
}

.dash-marketing-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.dash-marketing-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.15s;
}
.dash-marketing-card:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102,126,234,0.1);
}
.dash-marketing-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.dash-marketing-card-header i {
    font-size: 1.25rem;
}
.dash-marketing-card-header span {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e293b;
}
.dash-marketing-card-stat {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}
.dash-marketing-card-label {
    font-size: 0.75rem;
    color: #64748b;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .marketing-header { flex-direction: column; align-items: flex-start; }
    .marketing-header-right { width: 100%; }
    .mkt-form-row { grid-template-columns: 1fr; }
    .mkt-modal-content { max-height: 95vh; }
    .insta-grid { grid-template-columns: 1fr; }
    .gads-metrics-row { grid-template-columns: repeat(2, 1fr); }
    .mkt-list-item { flex-direction: column; }
    .mkt-list-item-actions { align-self: flex-end; }
}
