/**
 * Readability Checker - Custom Styles
 * Advanced styling for the readability analysis tool with animations and responsive design
 */

/* Tool-specific styling */
.readability-checker {
    min-height: calc(100vh - 200px);
}

/* Form styling */
.readability-form {
    transition: all 0.3s ease;
}

.readability-form:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Textarea enhancements */
#inputText {
    transition: all 0.3s ease;
    resize: vertical;
    min-height: 200px;
}

#inputText:focus {
    ring-color: rgba(147, 51, 234, 0.5);
    border-color: rgb(147, 51, 234);
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

/* Button styling */
.btn-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-gradient:before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-gradient:hover:before {
    left: 100%;
}

.btn-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

/* Quick action buttons */
.quick-action-btn {
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.quick-action-btn:hover {
    transform: translateY(-1px);
    border-color: currentColor;
    background-color: rgba(147, 51, 234, 0.05);
}

/* Real-time counters */
.counter-badge {
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Options panel */
.options-panel {
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.options-panel.collapsed {
    max-height: 60px;
    overflow: hidden;
}

.options-panel.expanded {
    max-height: 1000px;
}

/* Tab styling */
.tab-button {
    transition: all 0.3s ease;
    position: relative;
}

.tab-button:not(.active):hover {
    background-color: rgba(147, 51, 234, 0.1);
    color: rgb(147, 51, 234);
}

.tab-button.active::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

/* Tab content animations */
.tab-content {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Results banner */
.results-banner {
    animation: slideInDown 0.5s ease;
    position: relative;
    overflow: hidden;
}

.results-banner::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 2s infinite;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Quick metrics cards */
.metric-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.metric-value {
    animation: countUp 0.8s ease;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Score cards */
.score-card {
    transition: all 0.3s ease;
    animation: slideInLeft 0.6s ease;
}

.score-card:nth-child(2) {
    animation-delay: 0.1s;
}

.score-card:nth-child(3) {
    animation-delay: 0.2s;
}

.score-card:nth-child(4) {
    animation-delay: 0.3s;
}

.score-card:nth-child(5) {
    animation-delay: 0.4s;
}

.score-card:nth-child(6) {
    animation-delay: 0.5s;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.score-card:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Progress bars */
.progress-bar {
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShimmer 1.5s infinite;
}

@keyframes progressShimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Recommendation cards */
.recommendation-card {
    animation: slideInRight 0.6s ease;
    transition: all 0.3s ease;
}

.recommendation-card:nth-child(2) {
    animation-delay: 0.1s;
}

.recommendation-card:nth-child(3) {
    animation-delay: 0.2s;
}

.recommendation-card:nth-child(4) {
    animation-delay: 0.3s;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.recommendation-card:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Word tags */
.word-tag {
    transition: all 0.2s ease;
    cursor: pointer;
}

.word-tag:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Statistics grid */
.stats-grid {
    display: grid;
    gap: 1rem;
    animation: fadeInUp 0.6s ease;
}

/* Loading state */
.loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading-dots {
    display: inline-flex;
    gap: 0.25rem;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    animation: loadingBounce 1.4s infinite both;
}

.loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes loadingBounce {
    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Export buttons */
.export-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.export-btn::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.export-btn:hover::before {
    width: 300px;
    height: 300px;
}

.export-btn:active {
    transform: scale(0.95);
}

/* Toast notifications */
.toast {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    animation: slideInUp 0.5s ease;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .metric-card {
        margin-bottom: 1rem;
    }

    .tab-button {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .score-card {
        margin-bottom: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    #inputText {
        min-height: 150px;
    }

    .btn-gradient {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .quick-action-btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .tab-button {
        flex: 1;
        text-align: center;
    }
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    .readability-form {
        background-color: rgba(31, 41, 55, 0.8);
        border-color: rgba(75, 85, 99, 0.5);
    }

    .options-panel {
        background-color: rgba(31, 41, 55, 0.9);
    }

    .metric-card:hover {
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    }
}

/* Accessibility improvements */
.btn-gradient:focus,
.quick-action-btn:focus,
.tab-button:focus {
    outline: 2px solid rgb(147, 51, 234);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .quick-action-btn,
    .export-btn,
    .btn-gradient {
        display: none;
    }

    .tab-content {
        display: block !important;
    }

    .tab-button {
        display: none;
    }

    .results-banner {
        background: none !important;
        color: black !important;
    }

    .score-card,
    .recommendation-card {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .btn-gradient {
        background: #000;
        border: 2px solid #fff;
    }

    .metric-card,
    .score-card {
        border: 2px solid #000;
    }

    .word-tag {
        border: 1px solid #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .loading-spinner {
        animation: none;
    }
}
