/* CSS Variables for theming */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --secondary-color: #6b7280;
    --secondary-hover: #4b5563;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;

    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --transition: all 0.2s ease;
}

/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* App container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header styles */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: white;
    padding: 2rem 1.5rem;
    text-align: center;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.tagline {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

/* Main content */
.main-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Input section */
.input-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
}

.input-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.text-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: var(--transition);
    min-height: 150px;
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.text-input::placeholder {
    color: var(--text-muted);
}

/* Button styles */
.button-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: var(--primary-light);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Results section */
.results-section {
    animation: fadeIn 0.3s ease;
}

.results-section.hidden {
    display: none;
}

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

/* Results grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Card styles */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.full-width-card {
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title .icon {
    font-size: 1.25rem;
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.badge {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: auto;
}

/* Scores container */
.scores-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.score-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.score-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.score-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.score-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 9999px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.5s ease;
}

.score-fill.excellent { background: var(--success-color); }
.score-fill.good { background: #22c55e; }
.score-fill.average { background: var(--warning-color); }
.score-fill.difficult { background: #f97316; }
.score-fill.very-difficult { background: var(--danger-color); }

/* Stats container */
.stats-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: var(--radius-md);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Assessment container */
.assessment-container {
    text-align: center;
}

.assessment-level {
    font-size: 1.25rem;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: inline-block;
}

.assessment-level.very-easy {
    background: #dcfce7;
    color: #166534;
}

.assessment-level.easy {
    background: #d1fae5;
    color: #047857;
}

.assessment-level.fairly-easy {
    background: #fef3c7;
    color: #92400e;
}

.assessment-level.standard {
    background: #fef9c3;
    color: #a16207;
}

.assessment-level.fairly-difficult {
    background: #fed7aa;
    color: #c2410c;
}

.assessment-level.difficult {
    background: #fecaca;
    color: #dc2626;
}

.assessment-level.very-difficult {
    background: #fee2e2;
    color: #b91c1c;
}

.assessment-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Complex sentences container */
.complex-sentences-container {
    max-height: 400px;
    overflow-y: auto;
}

.complex-sentence-item {
    padding: 1rem;
    background: #fef3c7;
    border-left: 4px solid var(--warning-color);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-bottom: 0.75rem;
}

.complex-sentence-item:last-child {
    margin-bottom: 0;
}

.sentence-text {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.sentence-stats {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.sentence-stats span {
    background: var(--card-bg);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.no-complex {
    text-align: center;
    padding: 2rem;
    color: var(--success-color);
    font-weight: 500;
}

/* Suggestions container */
.suggestions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.complex-word {
    font-weight: 600;
    color: var(--danger-color);
    text-decoration: line-through;
    text-decoration-color: rgba(239, 68, 68, 0.5);
}

.arrow {
    color: var(--text-muted);
}

.simple-word {
    font-weight: 600;
    color: var(--success-color);
}

.no-suggestions {
    text-align: center;
    padding: 2rem;
    color: var(--success-color);
    font-weight: 500;
    width: 100%;
}

/* Explanations container */
.explanations-container {
    display: grid;
    gap: 1.25rem;
}

.explanation-item h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.explanation-item p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.score-scale {
    list-style: none;
    margin-top: 0.75rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
}

.score-scale li {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.scale-label {
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    margin-right: 0.25rem;
}

.scale-label.very-easy { background: #dcfce7; color: #166534; }
.scale-label.easy { background: #d1fae5; color: #047857; }
.scale-label.fairly-easy { background: #fef3c7; color: #92400e; }
.scale-label.standard { background: #fef9c3; color: #a16207; }
.scale-label.fairly-difficult { background: #fed7aa; color: #c2410c; }
.scale-label.difficult { background: #fecaca; color: #dc2626; }
.scale-label.very-difficult { background: #fee2e2; color: #b91c1c; }

/* Footer styles */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 1.5rem;
    text-align: center;
    margin-top: auto;
}

.footer p {
    font-size: 0.9rem;
}

.footer a {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.footer a:hover {
    color: white;
    text-decoration: underline;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .header {
        padding: 1.5rem 1rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .logo {
        width: 40px;
        height: 40px;
    }

    .main-content {
        padding: 1rem;
    }

    .input-section {
        padding: 1rem;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1rem;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .score-scale {
        grid-template-columns: 1fr;
    }

    .suggestion-item {
        width: 100%;
    }

    .sentence-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.25rem;
    }

    .tagline {
        font-size: 0.9rem;
    }

    .card-title {
        font-size: 1rem;
    }

    .stats-container {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .stat-item {
        padding: 0.5rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Loading state */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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