/* Modern CSS Reset and Base Styles */
:root {
    /* Light theme variables */
    --bg-color: #f8f9fa;
    --container-bg: #ffffff;
    --text-color: #2c3e50;
    --heading-color: #1a202c;
    --metric-bg: #f1f8ff;
    --metric-border: #3182ce;
    --metric-title-color: #2d3748;
    --button-bg: #3182ce;
    --button-hover: #2c5282;
    --button-disabled: #a0aec0;
    --result-bg: #ffffff;
    --positive-bg: #c6f6d5;
    --positive-color: #2f855a;
    --neutral-bg: #edf2f7;
    --neutral-color: #4a5568;
    --negative-bg: #fed7d7;
    --negative-color: #c53030;
    --error-bg: #fed7d7;
    --error-color: #c53030;
    --error-border: #f56565;
    --tooltip-bg: #2d3748;
    --tooltip-color: #ffffff;
    --footer-color: #718096;
    --textarea-border: #e2e8f0;
    --progress-bg: #edf2f7;
    --progress-fill: #3182ce;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition-base: all 0.3s ease;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Dark theme variables */
[data-theme="dark"] {
    --bg-color: #1a202c;
    --container-bg: #2d3748;
    --text-color: #e2e8f0;
    --heading-color: #f7fafc;
    --metric-bg: #2d3748;
    --metric-border: #4299e1;
    --metric-title-color: #f7fafc;
    --button-bg: #4299e1;
    --button-hover: #3182ce;
    --button-disabled: #4a5568;
    --result-bg: #2d3748;
    --positive-bg: #2f855a;
    --positive-color: #c6f6d5;
    --neutral-bg: #4a5568;
    --neutral-color: #e2e8f0;
    --negative-bg: #c53030;
    --negative-color: #fed7d7;
    --error-bg: #c53030;
    --error-color: #fed7d7;
    --error-border: #f56565;
    --tooltip-bg: #4a5568;
    --tooltip-color: #f7fafc;
    --footer-color: #a0aec0;
    --textarea-border: #4a5568;
    --progress-bg: #4a5568;
    --progress-fill: #4299e1;
}

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

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: var(--transition-base);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--container-bg);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition-base);
    flex: 1;
}

h1 {
    color: var(--heading-color);
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    letter-spacing: -0.025em;
}

/* Input styles */
.input-container {
    position: relative;
    margin-bottom: 1.5rem;
}

textarea {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: 2px solid var(--textarea-border);
    border-radius: 0.5rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.5;
    background-color: var(--container-bg);
    color: var(--text-color);
    transition: var(--transition-base);
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: var(--button-bg);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

/* Progress bar */
.progress-container {
    width: 100%;
    height: 4px;
    background-color: var(--progress-bg);
    border-radius: 2px;
    margin: 1rem 0;
    overflow: hidden;
    display: none;
}

.progress-bar {
    height: 100%;
    background-color: var(--progress-fill);
    width: 0;
    transition: width 0.3s ease;
}

/* Button styles */
.button-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1.5rem;
}

button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: none;
    background-color: var(--button-bg);
    color: white;
    cursor: pointer;
    transition: var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

button:hover {
    background-color: var(--button-hover);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background-color: var(--button-disabled);
    cursor: not-allowed;
    transform: none;
}

/* Results styles with animations */
.results {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.results.visible {
    opacity: 1;
    transform: translateY(0);
}

.result-item {
    background-color: var(--result-bg);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
    animation: slideIn 0.5s ease forwards;
    opacity: 0;
}

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

.result-item h3 {
    color: var(--heading-color);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--metric-border);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.metric {
    background-color: var(--metric-bg);
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid var(--metric-border);
    transition: var(--transition-base);
}

.metric:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.metric-title {
    font-weight: 600;
    color: var(--metric-title-color);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Sentiment styles */
.sentiment {
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
    font-weight: 600;
    margin-bottom: 1rem;
    transition: var(--transition-base);
}

/* Loading animation */
.loading {
    display: none;
    text-align: center;
    margin: 2rem 0;
}

.loading-spinner {
    border: 3px solid var(--progress-bg);
    border-top: 3px solid var(--progress-fill);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer styles */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--footer-color);
    font-size: 0.875rem;
    margin-top: auto;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        margin: 1rem;
        padding: 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }

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

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

    button {
        width: 100%;
    }

    textarea {
        min-height: 150px;
    }
}

@media (max-width: 480px) {
    .container {
        margin: 0.5rem;
        padding: 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .result-item {
        padding: 1rem;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus styles for accessibility */
:focus {
    outline: 2px solid var(--button-bg);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

/* Error message styles */
.error-message {
    background-color: var(--error-bg);
    color: var(--error-color);
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
    display: none;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Character count styles */
.char-count {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-color);
    opacity: 0.7;
}

.char-count.error {
    color: var(--error-color);
    font-weight: 600;
}

/* Theme toggle button */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: var(--button-bg);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.theme-toggle:hover {
    background-color: var(--button-hover);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.theme-toggle-text {
    display: inline-block;
}

/* Update button container for better alignment */
.button-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .button-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .button-container button {
        width: 100%;
    }
}

/* Tooltip styles */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background-color: var(--tooltip-bg);
    color: var(--tooltip-color);
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

[data-tooltip]:hover:before {
    opacity: 1;
    visibility: visible;
}

/* Accessibility improvements */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
} 