/* ===== AI GRAMMAR CHECKER CSS ===== */

.gram-wrapper { margin-bottom: 28px; }

/* Mode Tabs */
.gram-modes {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 14px; margin-bottom: 20px;
}
.gram-mode-btn {
    background: #fff; border: 2px solid #e5e7eb; border-radius: 16px;
    padding: 18px 16px; cursor: pointer; transition: all 0.25s;
    display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
}
.gram-mode-btn:hover { border-color: #10b981; transform: translateY(-2px); }
.gram-mode-btn.active { background: linear-gradient(135deg,#10b981,#059669); border-color: #059669; }
.gram-mode-icon  { font-size: 28px; }
.gram-mode-title { font-size: 15px; font-weight: 800; color: #1f2937; }
.gram-mode-sub   { font-size: 11px; color: #6b7280; }
.gram-mode-btn.active .gram-mode-title,
.gram-mode-btn.active .gram-mode-sub { color: #fff; }

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

/* Input Card */
.gram-input-card {
    background: #fff; border: 2px solid #e5e7eb; border-radius: 20px;
    padding: 20px; display: flex; flex-direction: column; gap: 12px;
}
.gram-input-header { display: flex; justify-content: space-between; align-items: center; }
.gram-card-title   { font-size: 15px; font-weight: 800; color: #1f2937; }
.gram-input-actions { display: flex; gap: 8px; }
.gram-icon-btn {
    background: #f3f4f6; border: 1.5px solid #e5e7eb; border-radius: 8px;
    padding: 6px 12px; font-size: 12px; font-weight: 600; color: #374151;
    cursor: pointer; transition: all 0.2s;
}
.gram-icon-btn:hover { border-color: #10b981; color: #065f46; }

.gram-textarea {
    width: 100%; min-height: 220px; border: 2px solid #e5e7eb;
    border-radius: 12px; padding: 14px; font-size: 14px; font-family: inherit;
    resize: vertical; outline: none; line-height: 1.7; color: #1f2937;
    transition: border-color 0.2s; box-sizing: border-box;
}
.gram-textarea:focus { border-color: #10b981; }

.gram-input-footer {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 10px;
}
.gram-count { font-size: 12px; color: #9ca3af; font-weight: 500; }

.gram-check-btn {
    background: linear-gradient(135deg,#10b981,#059669);
    color: #fff; border: none; border-radius: 12px;
    padding: 12px 28px; font-size: 15px; font-weight: 800;
    cursor: pointer; transition: all 0.25s;
    box-shadow: 0 4px 14px rgba(16,185,129,0.35);
}
.gram-check-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(16,185,129,0.45); }
.gram-check-btn:disabled { opacity: 0.7; cursor: not-allowed; }

/* Samples */
.gram-samples { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gram-samples-label { font-size: 12px; font-weight: 700; color: #6b7280; }
.gram-sample-btn {
    background: #f0fdf4; border: 1.5px solid #86efac; border-radius: 20px;
    padding: 5px 14px; font-size: 12px; font-weight: 600; color: #15803d;
    cursor: pointer; transition: all 0.2s;
}
.gram-sample-btn:hover { background: #dcfce7; border-color: #10b981; }

/* Output Card */
.gram-output-card {
    background: #fff; border: 2px solid #a7f3d0; border-radius: 20px;
    padding: 20px; overflow-y: auto; max-height: 600px;
}

/* Placeholder */
.gram-placeholder {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; min-height: 280px; text-align: center; gap: 10px;
}
.gram-ph-icon  { font-size: 52px; }
.gram-ph-title { font-size: 16px; font-weight: 800; color: #374151; }
.gram-ph-sub   { font-size: 13px; color: #9ca3af; }
.gram-mode-info {
    background: #f0fdf4; border: 2px solid #86efac; border-radius: 10px;
    padding: 10px 18px; font-size: 13px; color: #065f46; margin-top: 8px;
}

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

/* ---- CHECK MODE ---- */
.gram-score-row {
    display: flex; align-items: center; gap: 20px;
    background: linear-gradient(135deg,#f0fdf4,#dcfce7);
    border-radius: 14px; padding: 18px 20px; margin-bottom: 16px;
    border: 2px solid #86efac;
}
.gram-score-circle {
    width: 80px; height: 80px; border-radius: 50%;
    border: 5px solid #10b981; display: flex; flex-direction: column;
    align-items: center; justify-content: center; flex-shrink: 0;
    transition: border-color 0.5s, color 0.5s;
}
.gram-score-num   { font-size: 26px; font-weight: 900; line-height: 1; }
.gram-score-label { font-size: 10px; font-weight: 700; opacity: 0.7; }
.gram-score-grade   { font-size: 18px; font-weight: 800; color: #1f2937; margin-bottom: 4px; }
.gram-score-summary { font-size: 13px; color: #6b7280; margin-bottom: 6px; }
.gram-error-count   { font-size: 13px; font-weight: 700; color: #374151; }

.gram-errors-list { display: flex; flex-direction: column; gap: 10px; }
.gram-no-errors   { text-align: center; padding: 24px; font-size: 16px; font-weight: 700; color: #15803d; background: #f0fdf4; border-radius: 12px; }

.gram-error-item {
    background: #fff; border: 2px solid #e5e7eb; border-radius: 12px;
    overflow: hidden; transition: border-color 0.2s;
}
.gram-error-item:hover { border-color: #fca5a5; }
.gram-error-header {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px; background: #f8fafc; border-bottom: 1px solid #f3f4f6;
}
.gram-error-num {
    background: #374151; color: #fff; font-size: 11px; font-weight: 800;
    width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.gram-error-type  { font-size: 12px; font-weight: 700; }
.gram-error-body  { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.gram-error-wrong   { font-size: 13px; color: #dc2626; }
.gram-error-arrow   { font-size: 16px; color: #9ca3af; }
.gram-error-correct { font-size: 13px; color: #15803d; }
.gram-error-explain { font-size: 12px; color: #6b7280; background: #f8fafc; padding: 6px 10px; border-radius: 8px; line-height: 1.5; }

/* ---- CORRECT MODE ---- */
.gram-compare { background: #f8fafc; border-radius: 14px; padding: 16px; margin-bottom: 14px; border: 2px solid #e5e7eb; }
.gram-compare-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.gram-badge { font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 20px; }
.gram-badge-red   { background: #fff5f5; color: #dc2626; border: 1.5px solid #fca5a5; }
.gram-badge-green { background: #f0fdf4; color: #15803d; border: 1.5px solid #86efac; }
.gram-arrow { font-size: 18px; color: #9ca3af; }

.gram-score-mini {
    display: flex; gap: 14px; align-items: center; font-size: 13px;
    color: #374151; margin-bottom: 12px;
}
.gram-changes-badge {
    background: #dbeafe; color: #1d4ed8; font-size: 12px;
    font-weight: 700; padding: 2px 10px; border-radius: 20px;
}

.gram-corrected-text {
    background: linear-gradient(135deg,#f0fdf4,#ecfdf5);
    border: 2px solid #86efac; border-radius: 12px;
    padding: 14px; font-size: 14px; line-height: 1.8; color: #1f2937;
    white-space: pre-wrap; margin-bottom: 12px;
}
.gram-changes-list { display: flex; flex-direction: column; gap: 6px; }
.gram-change-item  { font-size: 13px; color: #374151; padding: 6px 10px; background: #fff; border-radius: 8px; border-left: 3px solid #10b981; }
.gram-copy-row     { text-align: center; }

/* ---- SUGGEST MODE ---- */
.gram-suggest-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.gram-meta-badge   { background: #eff6ff; border: 1.5px solid #93c5fd; border-radius: 20px; padding: 5px 14px; font-size: 13px; color: #1d4ed8; }

.gram-improved-box {
    background: linear-gradient(135deg,#f0fdf4,#ecfdf5);
    border: 2px solid #86efac; border-radius: 14px;
    padding: 16px; margin-bottom: 16px;
}
.gram-improved-label { font-size: 13px; font-weight: 800; color: #065f46; margin-bottom: 10px; }
.gram-improved-text  { font-size: 14px; line-height: 1.8; color: #1f2937; white-space: pre-wrap; margin-bottom: 12px; }

.gram-suggestions-list { display: flex; flex-direction: column; gap: 10px; }
.gram-suggest-item {
    background: #fff; border: 2px solid #e5e7eb; border-radius: 12px;
    padding: 12px 16px; border-left: 4px solid #10b981;
}
.gram-suggest-title  { font-size: 14px; font-weight: 800; color: #1f2937; margin-bottom: 4px; }
.gram-suggest-detail { font-size: 13px; color: #6b7280; line-height: 1.6; }

/* Shared copy btn */
.gram-copy-btn {
    background: linear-gradient(135deg,#10b981,#059669); color: #fff;
    border: none; border-radius: 10px; padding: 10px 22px;
    font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.2s;
    display: inline-block;
}
.gram-copy-btn:hover { transform: translateY(-1px); }

/* Error */
.gram-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,#f0fdf4,#dcfce7); border-radius: 16px; padding: 28px; margin-bottom: 24px; }
.info-box h4 { color: #14532d; 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: #10b981; font-size: 14px; font-weight: 700; margin-bottom: 4px; }

@media (max-width: 860px) {
    .gram-grid  { grid-template-columns: 1fr; }
    .gram-modes { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .gram-modes { grid-template-columns: 1fr 1fr; }
    .gram-score-row { flex-direction: column; text-align: center; }
}