/* =============================================
   Free AI Grammar Checker v1.0
   Author: Rouf xr | aitoolszen.com
   Theme: Editorial — clean, professional, teal
============================================= */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

:root {
    --aigc-primary:    #0ea5e9;
    --aigc-primary-dk: #0284c7;
    --aigc-green:      #10b981;
    --aigc-amber:      #f59e0b;
    --aigc-red:        #ef4444;
    --aigc-surface:    #f0f9ff;
    --aigc-border:     #bae6fd;
    --aigc-text:       #0c4a6e;
    --aigc-muted:      #64748b;
    --aigc-white:      #ffffff;
    --aigc-radius:     14px;
    --aigc-shadow:     0 4px 24px rgba(14,165,233,0.10);
}

.aigc-wrap {
    font-family: 'DM Sans', sans-serif;
    max-width: 860px;
    margin: 0 auto;
    color: var(--aigc-text);
    background: var(--aigc-white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(14,165,233,0.12);
}

/* ---- HEADER ---- */
.aigc-header {
    background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
    padding: 26px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}
.aigc-header-left { display: flex; align-items: center; gap: 16px; }
.aigc-title {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.3px;
}
.aigc-subtitle { margin: 0; font-size: 12.5px; color: #bae6fd; }
.aigc-subtitle a { color: #fde68a; text-decoration: none; font-weight: 600; }
.aigc-subtitle a:hover { text-decoration: underline; }

.aigc-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.aigc-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.aigc-b-grammar    { background: rgba(255,255,255,0.2); color: #fff; }
.aigc-b-spelling   { background: rgba(251,191,36,0.25); color: #fde68a; }
.aigc-b-punct      { background: rgba(52,211,153,0.25); color: #6ee7b7; }

/* ---- TIPS PANEL ---- */
.aigc-tips-panel { background: #f0f9ff; border-bottom: 1px solid var(--aigc-border); }
.aigc-tips-toggle {
    width: 100%;
    background: none;
    border: none;
    padding: 13px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--aigc-primary-dk);
    cursor: pointer;
}
.aigc-tips-toggle:hover { background: #e0f2fe; }
.aigc-caret { transition: transform 0.3s; font-size: 11px; }
.aigc-caret.open { transform: rotate(180deg); }
.aigc-tips-body { padding: 0 20px 20px; display: none; }
.aigc-tips-body.open { display: block; animation: aigcFadeIn 0.2s ease; }
@keyframes aigcFadeIn { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:none} }
.aigc-tips-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
@media (max-width: 680px) { .aigc-tips-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 400px) { .aigc-tips-grid { grid-template-columns: 1fr; } }
.aigc-tip-card {
    background: #fff;
    border: 1px solid var(--aigc-border);
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(14,165,233,0.06);
}
.aigc-tip-icon { font-size: 26px; margin-bottom: 8px; }
.aigc-tip-card h4 {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--aigc-primary-dk);
}
.aigc-tip-card ul,
.aigc-tip-card ol {
    margin: 0;
    padding-left: 16px;
    font-size: 12.5px;
    line-height: 1.9;
    color: var(--aigc-muted);
}

/* ---- EDITOR WRAP ---- */
.aigc-editor-wrap {
    padding: 24px 28px 20px;
    border-bottom: 1px solid #e0f2fe;
}

/* toolbar */
.aigc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}
.aigc-mode-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.aigc-mode-label { font-size: 12px; font-weight: 700; color: var(--aigc-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.aigc-mode-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.aigc-pill {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--aigc-border);
    background: #fff;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--aigc-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.aigc-pill:hover { border-color: var(--aigc-primary); color: var(--aigc-primary); }
.aigc-pill.active { background: var(--aigc-primary); border-color: var(--aigc-primary); color: #fff; }
.aigc-char-counter { font-size: 12px; color: var(--aigc-muted); font-family: 'DM Mono', monospace; }
.aigc-char-counter.over { color: var(--aigc-red); font-weight: 700; }

/* textarea */
.aigc-textarea-wrap { position: relative; }
.aigc-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 16px 44px 16px 18px;
    border: 2px solid var(--aigc-border);
    border-radius: var(--aigc-radius);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--aigc-text);
    background: #f8fbff;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.aigc-textarea:focus {
    border-color: var(--aigc-primary);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
    background: #fff;
}
.aigc-clear-btn {
    position: absolute;
    top: 12px; right: 12px;
    background: #e0f2fe;
    border: none;
    border-radius: 50%;
    width: 26px; height: 26px;
    font-size: 12px;
    color: var(--aigc-primary-dk);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.aigc-clear-btn:hover { background: #bae6fd; }

/* actions */
.aigc-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 14px;
    flex-wrap: wrap;
}
.aigc-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 24px;
    border-radius: 50px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    text-decoration: none;
}
.aigc-btn:hover { transform: translateY(-2px); }
.aigc-btn:active { transform: none; }
.aigc-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }
.aigc-btn-primary {
    background: linear-gradient(135deg, #0ea5e9, #0369a1);
    color: #fff;
    box-shadow: 0 4px 14px rgba(14,165,233,0.3);
}
.aigc-btn-primary:hover { box-shadow: 0 6px 20px rgba(14,165,233,0.4); }
.aigc-btn-secondary {
    background: #e0f2fe;
    color: var(--aigc-primary-dk);
    border: 1.5px solid var(--aigc-border);
}
.aigc-btn-secondary:hover { background: #bae6fd; }
.aigc-btn-apply {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16,185,129,0.25);
}

/* ---- LOADING ---- */
.aigc-loading {
    padding: 40px 28px;
    text-align: center;
    border-bottom: 1px solid #e0f2fe;
}
.aigc-loading-inner p { margin: 16px 0 0; font-size: 14px; font-weight: 600; color: var(--aigc-primary); }
.aigc-dots { display: flex; justify-content: center; gap: 8px; }
.aigc-dots span {
    width: 12px; height: 12px;
    background: var(--aigc-primary);
    border-radius: 50%;
    animation: aigcBounce 1.2s ease-in-out infinite;
}
.aigc-dots span:nth-child(2) { animation-delay: 0.2s; background: #38bdf8; }
.aigc-dots span:nth-child(3) { animation-delay: 0.4s; background: var(--aigc-green); }
@keyframes aigcBounce {
    0%,60%,100% { transform: translateY(0); }
    30%          { transform: translateY(-12px); }
}

/* ---- RESULTS ---- */
.aigc-results { padding: 24px 28px; border-bottom: 1px solid #e0f2fe; }
.aigc-results-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.aigc-results-title { margin: 0; font-size: 17px; font-weight: 800; color: var(--aigc-text); }

/* score */
.aigc-score-wrap { display: flex; align-items: center; gap: 10px; }
.aigc-score-circle {
    width: 58px; height: 58px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}
.aigc-score-high   { background: linear-gradient(135deg, #10b981, #059669); }
.aigc-score-medium { background: linear-gradient(135deg, #f59e0b, #d97706); }
.aigc-score-low    { background: linear-gradient(135deg, #ef4444, #dc2626); }
.aigc-score-label  { font-size: 12px; font-weight: 700; color: var(--aigc-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* stats row */
.aigc-stats-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.aigc-stat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    border: 1.5px solid;
}
.aigc-stat-total   { background: #f0f9ff; border-color: var(--aigc-border);  color: var(--aigc-text); }
.aigc-stat-grammar { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.aigc-stat-spell   { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.aigc-stat-punct   { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }

/* errors list */
.aigc-errors-section { margin-bottom: 22px; }
.aigc-section-title { margin: 0 0 12px; font-size: 14px; font-weight: 800; color: var(--aigc-text); text-transform: uppercase; letter-spacing: 0.5px; }
.aigc-errors-list { display: flex; flex-direction: column; gap: 10px; }
.aigc-error-item {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    gap: 10px 16px;
    align-items: start;
    padding: 14px 16px;
    border-radius: 10px;
    border-left: 4px solid;
    background: #fafafa;
    font-size: 13.5px;
}
@media(max-width:580px) { .aigc-error-item { grid-template-columns: auto 1fr; } }
.aigc-error-type {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
    align-self: start;
}
.aigc-type-grammar    { background: #fef3c7; color: #92400e; border-color: #f59e0b; }
.aigc-type-spelling   { background: #fee2e2; color: #991b1b; border-color: #ef4444; }
.aigc-type-punctuation{ background: #d1fae5; color: #065f46; border-color: #10b981; }
.aigc-error-item.aigc-type-grammar    { border-left-color: #f59e0b; }
.aigc-error-item.aigc-type-spelling   { border-left-color: #ef4444; }
.aigc-error-item.aigc-type-punctuation{ border-left-color: #10b981; }
.aigc-error-original   { color: #991b1b; text-decoration: line-through; font-family: 'DM Mono', monospace; font-size: 13px; }
.aigc-error-correction { color: #065f46; font-weight: 700; font-family: 'DM Mono', monospace; font-size: 13px; }
.aigc-error-expl { font-size: 12.5px; color: var(--aigc-muted); grid-column: 2 / -1; }

/* corrected text */
.aigc-corrected-section { margin-bottom: 18px; }
.aigc-corrected-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.aigc-copy-btn {
    background: #e0f2fe;
    border: 1.5px solid var(--aigc-border);
    border-radius: 20px;
    padding: 6px 16px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--aigc-primary-dk);
    cursor: pointer;
    transition: background 0.15s;
}
.aigc-copy-btn:hover { background: #bae6fd; }
.aigc-copy-btn.copied { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.aigc-corrected-box {
    background: #f0fdf4;
    border: 1.5px solid #6ee7b7;
    border-radius: var(--aigc-radius);
    padding: 18px 20px;
    font-size: 15px;
    line-height: 1.75;
    color: #1a3a2a;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'DM Sans', sans-serif;
}

/* result actions */
.aigc-result-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---- ALERT ---- */
.aigc-alert {
    margin: 0 28px 16px;
    padding: 13px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
}
.aigc-alert.success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.aigc-alert.error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.aigc-alert.info    { background: #e0f2fe; color: #0c4a6e; border: 1px solid #7dd3fc; }

/* ---- SPINNER ---- */
.aigc-spinner {
    width: 16px; height: 16px;
    border: 2.5px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: aigcSpin 0.7s linear infinite;
    display: inline-block;
}
@keyframes aigcSpin { to { transform: rotate(360deg); } }

/* ---- FOOTER ---- */
.aigc-footer {
    text-align: center;
    padding: 14px;
    background: #f8fbff;
    border-top: 1px solid #e0f2fe;
}
.aigc-footer p { margin: 0; font-size: 12px; color: var(--aigc-muted); }
.aigc-footer a { color: var(--aigc-primary); text-decoration: none; font-weight: 700; }

/* perfect badge */
.aigc-perfect-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border: 1.5px solid #6ee7b7;
    border-radius: 10px;
    padding: 14px 20px;
    font-weight: 700;
    color: #065f46;
    font-size: 15px;
    margin-bottom: 18px;
    width: 100%;
    box-sizing: border-box;
}
