/* ===== AI EMAIL WRITER CSS ===== */
.email-wrapper { margin-bottom: 28px; }

/* Type Cards */
.email-types { background: #fff; border: 2px solid #e5e7eb; border-radius: 20px; padding: 20px 24px; margin-bottom: 20px; }
.email-types-title { font-size: 14px; font-weight: 800; color: #374151; margin-bottom: 14px; }
.email-types-grid  { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; }
.email-type-btn {
    background: #f8fafc; border: 2px solid #e5e7eb; border-radius: 12px;
    padding: 12px 8px; cursor: pointer; transition: all 0.2s;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    font-size: 22px;
}
.email-type-btn span { font-size: 11px; font-weight: 700; color: #374151; line-height: 1.3; }
.email-type-btn:hover { border-color: #2563eb; transform: translateY(-2px); }
.email-type-btn.active { background: linear-gradient(135deg,#2563eb,#1d4ed8); border-color: #1d4ed8; }
.email-type-btn.active span { color: #fff; }

/* Main Grid */
.email-main-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Cards */
.email-input-card, .email-output-card {
    background: #fff; border: 2px solid #e5e7eb; border-radius: 20px; padding: 24px;
}
.email-output-card { border-color: #93c5fd; }
.email-card-title  { font-size: 16px; font-weight: 800; color: #1f2937; margin-bottom: 20px; }

.email-field  { margin-bottom: 16px; }
.email-label  { display: block; font-size: 13px; font-weight: 700; color: #374151; margin-bottom: 6px; }

.email-input {
    width: 100%; border: 2px solid #e5e7eb; border-radius: 10px;
    padding: 10px 14px; font-size: 14px; outline: none; font-family: inherit;
    transition: border-color 0.2s; box-sizing: border-box; color: #1f2937;
}
.email-input:focus { border-color: #2563eb; }

.email-textarea {
    width: 100%; min-height: 160px; border: 2px solid #e5e7eb; border-radius: 10px;
    padding: 12px 14px; font-size: 14px; font-family: inherit; resize: vertical;
    outline: none; transition: border-color 0.2s; box-sizing: border-box;
    color: #1f2937; line-height: 1.6;
}
.email-textarea:focus { border-color: #2563eb; }
.email-char-count { font-size: 11px; color: #9ca3af; text-align: right; margin-top: 4px; }

.email-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.email-half {}

.email-btn-group { display: flex; flex-wrap: wrap; gap: 6px; }
.email-opt-btn {
    background: #f8fafc; border: 2px solid #e5e7eb; border-radius: 8px;
    padding: 6px 12px; font-size: 12px; font-weight: 600; color: #374151;
    cursor: pointer; transition: all 0.2s;
}
.email-opt-btn:hover  { border-color: #2563eb; }
.email-opt-btn.active { background: linear-gradient(135deg,#2563eb,#1d4ed8); color: #fff; border-color: #1d4ed8; }

.email-generate-btn {
    width: 100%; background: linear-gradient(135deg,#2563eb,#1d4ed8);
    color: #fff; border: none; border-radius: 14px; padding: 16px;
    font-size: 17px; font-weight: 800; cursor: pointer; margin-top: 8px;
    transition: all 0.25s; box-shadow: 0 4px 16px rgba(37,99,235,0.35);
}
.email-generate-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(37,99,235,0.45); }
.email-generate-btn:disabled { opacity: 0.7; cursor: not-allowed; }

/* Placeholder */
.email-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 20px; text-align: center; gap: 10px; min-height: 300px; }
.email-ph-icon { font-size: 52px; }
.email-ph-text { font-size: 16px; font-weight: 700; color: #374151; }
.email-ph-sub  { font-size: 13px; color: #9ca3af; }

/* Loading */
.email-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 20px; gap: 14px; min-height: 300px; }
.email-loading-dots { display: flex; gap: 8px; }
.email-loading-dots span { width: 10px; height: 10px; background: #2563eb; border-radius: 50%; animation: email-bounce 1.2s infinite; }
.email-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.email-loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes email-bounce { 0%,80%,100%{transform:scale(0.7);opacity:0.5} 40%{transform:scale(1.2);opacity:1} }
.email-loading-text { font-size: 14px; color: #6b7280; font-weight: 500; }

/* Subject Box */
.email-subject-box {
    background: linear-gradient(135deg,#eff6ff,#dbeafe); border: 2px solid #93c5fd;
    border-radius: 12px; padding: 14px 16px; margin-bottom: 14px;
    display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap;
}
.email-subject-label { font-size: 12px; font-weight: 700; color: #1d4ed8; white-space: nowrap; }
.email-subject-text  { flex: 1; font-size: 14px; font-weight: 700; color: #1e3a8a; line-height: 1.5; min-width: 150px; }

/* Body Box */
.email-body-box { background: #f8fafc; border: 2px solid #e5e7eb; border-radius: 12px; padding: 16px; }
.email-body-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.email-body-label  { font-size: 12px; font-weight: 700; color: #374151; }
.email-body-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.email-word-count   { font-size: 11px; color: #9ca3af; }
.email-body-text    { font-size: 14px; color: #1f2937; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }

.email-copy-small {
    background: #fff; border: 2px solid #e5e7eb; border-radius: 7px;
    padding: 4px 10px; font-size: 11px; font-weight: 700; color: #374151;
    cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.email-copy-small:hover { border-color: #2563eb; color: #1d4ed8; }

.email-copy-all-btn {
    background: linear-gradient(135deg,#2563eb,#1d4ed8); color: #fff;
    border: none; border-radius: 7px; padding: 6px 12px;
    font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
    transition: all 0.2s;
}
.email-copy-all-btn:hover { transform: translateY(-1px); }

/* Error */
.email-error { display: flex; align-items: center; gap: 8px; padding: 20px; background: #fff5f5; border-radius: 12px; color: #dc2626; font-size: 14px; }

/* Info Box */
.info-box { background: linear-gradient(135deg,#eff6ff,#dbeafe); border-radius: 16px; padding: 28px; margin-bottom: 24px; }
.info-box h4 { color: #1e3a8a; font-size: 20px; margin-bottom: 18px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: 14px; }
.info-item { background: #fff; border-radius: 12px; padding: 16px; font-size: 14px; color: #374151; line-height: 1.6; }
.info-item strong { display: block; color: #2563eb; font-size: 14px; font-weight: 700; margin-bottom: 4px; }

@media (max-width: 900px) {
    .email-types-grid  { grid-template-columns: repeat(4,1fr); }
    .email-main-grid   { grid-template-columns: 1fr; }
    .email-row         { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .email-types-grid  { grid-template-columns: repeat(2,1fr); }
}