/* Toxicity Checker - Notion-like UI */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
  --font-sans: "Inter", sans-serif;
  --text-color: rgb(25, 25, 24);
  --bg-color: #fafafa;
  --border-color: rgba(55, 53, 47, 0.12);
  --space-16: 16px;
  --space-24: 24px;
  --space-32: 32px;
}

body {
    font-family: var(--font-sans);
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-32) var(--space-24);
}

/* ========== APP HEADER ========== */
.app-header {
    text-align: center;
    margin-bottom: var(--space-24);
    padding: var(--space-16) var(--space-24);
    margin: calc(-1 * var(--space-32)) calc(-1 * var(--space-24)) var(--space-24);
}

.app-header__title {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: var(--text-color);
    margin: 0;
    padding-bottom: var(--space-16);
}

.app-header__title::after {
    content: "";
    display: block;
    width: 40%;
    height: 1px;
    background: var(--border-color);
    margin: var(--space-16) auto 0;
}

/* Mobile */
@media (max-width: 768px) {
    .container {
        padding: var(--space-24) var(--space-16);
    }

    .app-header {
        padding: 12px var(--space-16);
        margin: calc(-1 * var(--space-24)) calc(-1 * var(--space-16)) var(--space-24);
    }

    .app-header__title {
        font-size: 28px;
    }
}

/* Input Section */
.input-section {
    margin-bottom: 32px;
}

.input-card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.input-wrapper {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: rgba(25, 25, 24, 0.6);
    margin-bottom: 8px;
}

textarea {
    width: 100%;
    min-height: 180px;
    padding: 16px;
    font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.55;
    color: rgb(25, 25, 24);
    background: rgba(55, 53, 47, 0.04);
    border: 0.5px solid rgba(55, 53, 47, 0.16);
    border-radius: 8px;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s ease, background 0.2s ease;
}

textarea:focus {
    border-color: #2383E2;
    background: white;
}

textarea::placeholder {
    color: rgba(25, 25, 24, 0.4);
}

.button-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.char-count {
    font-size: 14px;
    color: rgba(25, 25, 24, 0.5);
}

/* Primary Button */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 16px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 50px;
    background: #000000;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
    background: #1a1a1a;
}

.btn-primary:active:not(:disabled) {
    background: #333333;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 48px 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-top: 24px;
}

.spinner-container {
    margin-bottom: 24px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 3px solid rgba(35, 131, 226, 0.2);
    border-top-color: #2383E2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 18px;
    font-weight: 500;
    color: rgb(25, 25, 24);
    margin-bottom: 8px;
}

.loading-subtext {
    font-size: 14px;
    color: rgba(25, 25, 24, 0.6);
}

/* Error State */
.error-state {
    text-align: center;
    padding: 32px 24px;
    background: #fef2f2;
    border: 0.5px solid #fecaca;
    border-radius: 12px;
    margin-top: 24px;
}

.error-icon {
    color: #dc2626;
    margin-bottom: 12px;
}

.error-icon svg {
    width: 40px;
    height: 40px;
}

.error-text {
    font-size: 16px;
    color: #991b1b;
    margin-bottom: 16px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    font-size: 16px;
    font-weight: 500;
    color: #2383E2;
    background: white;
    border: 0.5px solid #2383E2;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background: rgba(35, 131, 226, 0.08);
}

/* Result Section */
.result-section {
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Score Card */
.score-card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
}

.score-header {
    display: flex;
    align-items: center;
    gap: 32px;
}

.score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.score-circle.severity-none {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border: 3px solid #22c55e;
}

.score-circle.severity-low {
    background: linear-gradient(135deg, #fef9c3 0%, #fef08a 100%);
    border: 3px solid #eab308;
}

.score-circle.severity-medium {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    border: 3px solid #f97316;
}

.score-circle.severity-high {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    border: 3px solid #ef4444;
}

.score-circle.severity-severe {
    background: linear-gradient(135deg, #fecdd3 0%, #fda4af 100%);
    border: 3px solid #dc2626;
}

.score-number {
    font-size: 32px;
    font-weight: 700;
    color: rgb(25, 25, 24);
    line-height: 1;
}

.score-label {
    font-size: 12px;
    font-weight: 500;
    color: rgba(25, 25, 24, 0.6);
    margin-top: 4px;
}

.score-info {
    flex: 1;
}

.score-title {
    font-size: 22px;
    font-weight: 600;
    color: rgb(25, 25, 24);
    margin-bottom: 8px;
}

.score-summary {
    font-size: 16px;
    color: rgba(25, 25, 24, 0.8);
    line-height: 1.5;
    margin-bottom: 12px;
}

.severity-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 4px;
}

.severity-badge.severity-none {
    background: #dcfce7;
    color: #166534;
}

.severity-badge.severity-low {
    background: #fef9c3;
    color: #854d0e;
}

.severity-badge.severity-medium {
    background: #fed7aa;
    color: #9a3412;
}

.severity-badge.severity-high {
    background: #fecaca;
    color: #991b1b;
}

.severity-badge.severity-severe {
    background: #fecdd3;
    color: #881337;
}

/* Section Cards */
.section-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: rgb(25, 25, 24);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title svg {
    width: 20px;
    height: 20px;
    color: rgba(25, 25, 24, 0.6);
}

/* Issues List */
.issues-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.issue-item {
    padding: 16px;
    border-radius: 8px;
    border-left: 0.5px solid;
}

.issue-item.severity-low {
    background: #fffbeb;
    border-left-color: #eab308;
}

.issue-item.severity-medium {
    background: #fff7ed;
    border-left-color: #f97316;
}

.issue-item.severity-high {
    background: #fef2f2;
    border-left-color: #ef4444;
}

.issue-item.severity-severe {
    background: #fff1f2;
    border-left-color: #dc2626;
}

.issue-text {
    font-size: 16px;
    font-weight: 500;
    color: rgb(25, 25, 24);
    margin-bottom: 6px;
}

.issue-text mark {
    background: rgba(239, 68, 68, 0.2);
    padding: 2px 4px;
    border-radius: 3px;
}

.issue-category {
    font-size: 12px;
    font-weight: 500;
    color: rgba(25, 25, 24, 0.5);
    margin-bottom: 8px;
}

.issue-explanation {
    font-size: 14px;
    color: rgba(25, 25, 24, 0.8);
    margin-bottom: 12px;
    line-height: 1.5;
}

.issue-suggestion {
    font-size: 14px;
    color: #166534;
    background: rgba(34, 197, 94, 0.1);
    padding: 10px 12px;
    border-radius: 6px;
}

.issue-suggestion strong {
    font-weight: 600;
}

/* Categories List */
.categories-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 0.5px solid rgba(55, 53, 47, 0.06);
}

.category-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.category-name {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: rgb(25, 25, 24);
}

.category-bar-container {
    width: 120px;
    height: 8px;
    background: rgba(55, 53, 47, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.category-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.category-bar.severity-none {
    background: #22c55e;
}

.category-bar.severity-low {
    background: #eab308;
}

.category-bar.severity-medium {
    background: #f97316;
}

.category-bar.severity-high {
    background: #ef4444;
}

.category-bar.severity-severe {
    background: #dc2626;
}

.category-score {
    width: 40px;
    text-align: right;
    font-size: 14px;
    font-weight: 600;
    color: rgba(25, 25, 24, 0.7);
}

.category-status {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-status svg {
    width: 14px;
    height: 14px;
}

.category-status.severity-none {
    background: #dcfce7;
    color: #22c55e;
}

.category-status.severity-low {
    background: #fef9c3;
    color: #ca8a04;
}

.category-status.severity-medium {
    background: #fed7aa;
    color: #ea580c;
}

.category-status.severity-high {
    background: #fecaca;
    color: #dc2626;
}

.category-status.severity-severe {
    background: #fecdd3;
    color: #be123c;
}

/* Improved Text Section */
.improved-section {
    margin-bottom: 24px;
}

.improved-text-container {
    position: relative;
}

.improved-text {
    font-size: 16px;
    line-height: 1.6;
    color: rgb(25, 25, 24);
    background: rgba(34, 197, 94, 0.06);
    border: 0.5px solid rgba(34, 197, 94, 0.2);
    border-radius: 8px;
    padding: 16px;
    padding-right: 80px;
    white-space: pre-wrap;
}

.btn-copy {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #166534;
    background: white;
    border: 0.5px solid rgba(34, 197, 94, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copy:hover {
    background: #dcfce7;
}

.btn-copy.copied {
    background: #22c55e;
    color: white;
    border-color: #22c55e;
}

.btn-copy svg {
    width: 14px;
    height: 14px;
}

/* Result Actions */
.result-actions {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 24px 16px;
    }
    
    .input-card,
    .score-card,
    .section-card {
        padding: 24px;
    }
    
    .score-header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .score-circle {
        width: 90px;
        height: 90px;
    }
    
    .score-number {
        font-size: 28px;
    }
    
    textarea {
        font-size: 16px;
    }
    
    .button-row {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .char-count {
        text-align: center;
    }
    
    .btn-primary {
        justify-content: center;
    }
    
    .category-item {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .category-name {
        flex-basis: 100%;
    }
    
    .category-bar-container {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .improved-text {
        padding-right: 16px;
        padding-bottom: 60px;
    }
    
    .btn-copy {
        top: auto;
        bottom: 12px;
        right: 12px;
    }
}
