/* ========================================
   SeriesWire Readability Analyzer – Styles
   Author: SeriesWire.com
   ======================================== */

:root {
    --swra-orange:      #e97b33;
    --swra-orange-light:#f9a96b;
    --swra-blue:        #01266f;
    --swra-blue-light:  #1a3d8f;
    --swra-green:       #22c55e;
    --swra-yellow:      #eab308;
    --swra-red:         #ef4444;
    --swra-bg:          #f8f9fc;
    --swra-card:        #ffffff;
    --swra-border:      #e2e8f0;
    --swra-text:        #1e293b;
    --swra-muted:       #64748b;
    --swra-radius:      12px;
    --swra-shadow:      0 2px 16px rgba(1,38,111,0.08);
    --swra-transition:  0.2s ease;
}

.swra-wrapper * { box-sizing: border-box; margin: 0; padding: 0; }

.swra-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    color: var(--swra-text);
    background: var(--swra-bg);
    border-radius: var(--swra-radius);
    padding: 28px 24px 36px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.swra-header { text-align: center; margin-bottom: 24px; }
.swra-title {
    font-size: clamp(1.1rem, 2.2vw, 1.4rem);
    font-weight: 600;
    color: var(--swra-muted);
    letter-spacing: 0.01em;
}
.swra-subtitle { color: var(--swra-muted); font-size: 0.97rem; }

/* Summary Card */
.swra-summary-card {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    background: linear-gradient(135deg, var(--swra-blue) 0%, var(--swra-blue-light) 100%);
    color: #fff;
    border-radius: var(--swra-radius);
    padding: 20px 28px;
    margin-bottom: 24px;
    align-items: center;
    justify-content: space-around;
    box-shadow: var(--swra-shadow);
    transition: opacity var(--swra-transition);
}
.swra-summary-grade,
.swra-summary-ease,
.swra-summary-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 120px;
}
.swra-grade-label,
.swra-ease-label,
.swra-time-label { font-size: 0.78rem; opacity: 0.8; letter-spacing: 0.05em; text-transform: uppercase; }
.swra-grade-value {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--swra-orange-light);
    line-height: 1;
}
.swra-ease-badge {
    background: var(--swra-orange);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
}
.swra-time-value { font-size: 1.1rem; font-weight: 700; }

/* Main layout */
.swra-main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}
@media (max-width: 820px) {
    .swra-main-layout { grid-template-columns: 1fr; }
}

/* Input panel */
.swra-input-panel { display: flex; flex-direction: column; gap: 12px; }
.swra-textarea-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.swra-input-label { font-weight: 700; font-size: 0.95rem; color: var(--swra-blue); }
.swra-toolbar-btns { display: flex; gap: 8px; }

.swra-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--swra-transition);
    white-space: nowrap;
}
.swra-btn-primary {
    background: var(--swra-orange);
    color: #fff;
}
.swra-btn-primary:hover { background: #d46a22; transform: translateY(-1px); }
.swra-btn-secondary {
    background: var(--swra-border);
    color: var(--swra-text);
}
.swra-btn-secondary:hover { background: #cbd5e1; transform: translateY(-1px); }

.swra-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--swra-border);
    border-radius: var(--swra-radius);
    font-size: 0.97rem;
    line-height: 1.7;
    resize: vertical;
    transition: border-color var(--swra-transition), box-shadow var(--swra-transition);
    background: #fff;
    color: var(--swra-text);
    font-family: inherit;
    min-height: 220px;
}
.swra-textarea:focus {
    outline: none;
    border-color: var(--swra-orange);
    box-shadow: 0 0 0 3px rgba(233,123,51,0.15);
}

/* Legend */
.swra-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--swra-muted);
    align-items: center;
}
.swra-legend-item { display: flex; align-items: center; gap: 5px; }
.swra-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.swra-dot-green  { background: var(--swra-green); }
.swra-dot-yellow { background: var(--swra-yellow); }
.swra-dot-red    { background: var(--swra-red); }

/* Highlighted Preview */
.swra-preview-header {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--swra-blue);
    padding: 0 0 4px;
    border-bottom: 2px solid var(--swra-border);
}
.swra-highlighted-output {
    background: #fff;
    border: 2px solid var(--swra-border);
    border-radius: var(--swra-radius);
    padding: 14px 16px;
    font-size: 0.95rem;
    line-height: 1.85;
    min-height: 90px;
    color: var(--swra-text);
    word-break: break-word;
}
.swra-highlighted-output .swra-sent-easy   { background: rgba(34,197,94,0.15);  border-radius: 3px; padding: 1px 2px; }
.swra-highlighted-output .swra-sent-medium { background: rgba(234,179,8,0.18);  border-radius: 3px; padding: 1px 2px; }
.swra-highlighted-output .swra-sent-hard   { background: rgba(239,68,68,0.15);  border-radius: 3px; padding: 1px 2px; }

/* Metrics Panel */
.swra-metrics-panel { display: flex; flex-direction: column; gap: 20px; }
.swra-metrics-section {
    background: var(--swra-card);
    border: 1px solid var(--swra-border);
    border-radius: var(--swra-radius);
    padding: 18px 20px;
    box-shadow: var(--swra-shadow);
}
.swra-section-title {
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--swra-blue);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--swra-border);
}

/* Metric Cards */
.swra-metric-card {
    padding: 10px 0;
    border-bottom: 1px solid var(--swra-border);
}
.swra-metric-card:last-child { border-bottom: none; }
.swra-metric-name { font-size: 0.82rem; color: var(--swra-muted); font-weight: 600; margin-bottom: 3px; }
.swra-metric-value {
    font-size: 1.7rem;
    font-weight: 900;
    color: var(--swra-orange);
    line-height: 1.1;
}
.swra-metric-sub { font-size: 0.8rem; color: var(--swra-muted); margin-top: 2px; }

/* Progress Bar */
.swra-bar-wrap {
    background: var(--swra-border);
    border-radius: 99px;
    height: 6px;
    margin-top: 8px;
    overflow: hidden;
}
.swra-bar {
    height: 100%;
    width: 0%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--swra-orange), var(--swra-green));
    transition: width 0.4s ease;
}

/* Stats List */
.swra-stats-list { list-style: none; }
.swra-stats-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--swra-border);
    font-size: 0.88rem;
}
.swra-stats-list li:last-child { border-bottom: none; }
.swra-stat-key { color: var(--swra-muted); }
.swra-stat-val { font-weight: 700; color: var(--swra-blue); min-width: 38px; text-align: right; }

/* Toast */
.swra-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--swra-blue);
    color: #fff;
    padding: 12px 22px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    z-index: 99999;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}
.swra-toast.swra-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

/* Utility */
.swra-hidden { display: none !important; }
@media (max-width: 480px) {
    .swra-wrapper { padding: 16px 12px 24px; }
    .swra-summary-card { padding: 16px; }
    .swra-grade-value { font-size: 1.8rem; }
}
