/**
 * Correlation Calculator Styles
 *
 * Only calculator-specific styles are here.
 * Layout, cards, forms use Bootstrap and shared calculator styles.
 *
 * @package Ryan_OConnell_Theme
 * @since 1.0.0
 */

/* CSS Variables for Rating Colors */
:root {
    --cc-excellent: #15803d;
    --cc-excellent-bg: #dcfce7;
    --cc-good: #22c55e;
    --cc-good-bg: #dcfce7;
    --cc-moderate: #eab308;
    --cc-moderate-bg: #fef9c3;
    --cc-limited: #f59e0b;
    --cc-limited-bg: #fef3c7;
    --cc-minimal: #ef4444;
    --cc-minimal-bg: #fee2e2;
    --cc-none: #991b1b;
    --cc-none-bg: #fee2e2;
}

/* ==========================================================================
   Animations
   ========================================================================== */

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

/* Card Entrance Animation */
.correlation-calculator .calculator-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Staggered delays for left column cards */
.correlation-calculator .col-lg-5 .calculator-card:nth-child(1) { animation-delay: 0ms; }
.correlation-calculator .col-lg-5 .calculator-card:nth-child(2) { animation-delay: 100ms; }
.correlation-calculator .col-lg-5 .calculator-card:nth-child(3) { animation-delay: 200ms; }

/* Staggered delays for right column cards */
.correlation-calculator .col-lg-7 .calculator-card:nth-child(1) { animation-delay: 50ms; }
.correlation-calculator .col-lg-7 .calculator-card:nth-child(2) { animation-delay: 150ms; }
.correlation-calculator .col-lg-7 .calculator-card:nth-child(3) { animation-delay: 250ms; }

/* Educational section card animation */
.correlation-calculator .educational-section {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 300ms;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* FAQ accordion items animation */
.correlation-calculator .faq-accordion .accordion-item {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.correlation-calculator .faq-accordion .accordion-item:nth-child(1) { animation-delay: 350ms; }
.correlation-calculator .faq-accordion .accordion-item:nth-child(2) { animation-delay: 400ms; }
.correlation-calculator .faq-accordion .accordion-item:nth-child(3) { animation-delay: 450ms; }
.correlation-calculator .faq-accordion .accordion-item:nth-child(4) { animation-delay: 500ms; }
.correlation-calculator .faq-accordion .accordion-item:nth-child(5) { animation-delay: 550ms; }
.correlation-calculator .faq-accordion .accordion-item:nth-child(6) { animation-delay: 600ms; }

/* Related calculator cards animation */
.correlation-calculator .related-calc-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
}
.correlation-calculator .row > .col-md-4:nth-child(1) .related-calc-card { animation-delay: 400ms; }
.correlation-calculator .row > .col-md-4:nth-child(2) .related-calc-card { animation-delay: 500ms; }
.correlation-calculator .row > .col-md-4:nth-child(3) .related-calc-card { animation-delay: 600ms; }

/* Enhanced hover effects */
.correlation-calculator .calculator-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.correlation-calculator .educational-section:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.correlation-calculator .faq-accordion .accordion-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

/* Hero Section */
.correlation-calculator .hero-section {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 50px 0;
    margin-bottom: 0;
}

.correlation-calculator .hero-section h1 {
    font-weight: 700;
    font-size: 2.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: white !important;
}

.correlation-calculator .hero-section .lead {
    font-size: 1.15rem;
    opacity: 0.95;
}

/* Hidden Utility */
.cc-hidden {
    display: none !important;
}

/* Tooltip for Input Labels */
.cc-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #6b7280;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    cursor: help;
    position: relative;
    margin-left: 4px;
}

.cc-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 400;
    width: 220px;
    text-align: center;
    z-index: 100;
    margin-bottom: 8px;
    white-space: normal;
}

/* Correlation Scale Visual (Unique to this calculator) */
.cc-correlation-scale {
    margin: 20px 0 30px;
    padding: 0 10px;
}

.cc-scale-bar {
    position: relative;
    height: 12px;
    background: linear-gradient(to right,
        var(--cc-excellent) 0%,
        var(--cc-good) 25%,
        var(--cc-moderate) 50%,
        var(--cc-limited) 75%,
        var(--cc-minimal) 100%
    );
    border-radius: 6px;
    margin-bottom: 10px;
}

.cc-scale-marker {
    position: absolute;
    top: -4px;
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid #1f2937;
    border-radius: 50%;
    transform: translateX(-50%);
    transition: left 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cc-scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
}

.cc-scale-descriptions {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 4px;
}

/* Rating Badge (main result) */
.cc-rating-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

.cc-rating-badge.excellent {
    background: var(--cc-excellent-bg);
    color: var(--cc-excellent);
}

.cc-rating-badge.good {
    background: var(--cc-good-bg);
    color: var(--cc-good);
}

.cc-rating-badge.moderate {
    background: var(--cc-moderate-bg);
    color: var(--cc-moderate);
}

.cc-rating-badge.limited {
    background: var(--cc-limited-bg);
    color: var(--cc-limited);
}

.cc-rating-badge.minimal {
    background: var(--cc-minimal-bg);
    color: var(--cc-minimal);
}

.cc-rating-badge.none {
    background: var(--cc-none-bg);
    color: var(--cc-none);
}

/* Formula Steps (generated by JS) */
.cc-formula-step {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #e5e7eb;
    font-family: 'Courier New', monospace;
    font-size: 0.9375rem;
}

.cc-formula-step:last-child {
    border-bottom: none;
}

.cc-step-label {
    font-weight: 600;
    color: #1f2937;
    min-width: 120px;
}

.cc-step-value {
    color: #6b7280;
}

/* Table Badges for Rating Table */
.cc-table-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.cc-table-badge.excellent {
    background: var(--cc-excellent-bg);
    color: var(--cc-excellent);
}

.cc-table-badge.good {
    background: var(--cc-good-bg);
    color: var(--cc-good);
}

.cc-table-badge.moderate {
    background: var(--cc-moderate-bg);
    color: var(--cc-moderate);
}

.cc-table-badge.limited {
    background: var(--cc-limited-bg);
    color: var(--cc-limited);
}

.cc-table-badge.minimal {
    background: var(--cc-minimal-bg);
    color: var(--cc-minimal);
}

.cc-table-badge.none {
    background: var(--cc-none-bg);
    color: var(--cc-none);
}

/* FAQ Accordion */
.correlation-calculator .faq-accordion .accordion-item {
    border: 1px solid #e5e7eb;
    margin-bottom: 0.5rem;
    border-radius: 8px !important;
    overflow: hidden;
}

.correlation-calculator .faq-accordion .accordion-button {
    font-weight: 500;
    color: #1f2937;
    background: white;
    padding: 1rem 1.25rem;
}

.correlation-calculator .faq-accordion .accordion-button:not(.collapsed) {
    background: #f9fafb;
    color: #2563eb;
}

.correlation-calculator .faq-accordion .accordion-button:focus {
    box-shadow: none;
    border-color: #e5e7eb;
}

.correlation-calculator .faq-accordion .accordion-body {
    color: #4b5563;
    line-height: 1.7;
    padding: 1rem 1.25rem;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .correlation-calculator .hero-section {
        padding: 40px 0;
    }
    .correlation-calculator .hero-section h1 {
        font-size: 2rem;
    }
}

@media (max-width: 767px) {
    .correlation-calculator .hero-section {
        padding: 30px 0;
    }
    .correlation-calculator .hero-section h1 {
        font-size: 1.75rem;
    }
}

@media (max-width: 576px) {
    .cc-scale-labels {
        font-size: 0.75rem;
    }

    .cc-scale-descriptions {
        font-size: 0.6875rem;
    }
}

/* Related Calculators */
.correlation-calculator .related-calc-card {
    display: block;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 25px 20px;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
}

.correlation-calculator .related-calc-card:hover {
    border-color: #2563eb;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
    text-decoration: none;
    color: inherit;
}

.correlation-calculator .related-calc-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.correlation-calculator .related-calc-icon i {
    color: white;
}

.correlation-calculator .related-calc-image {
    width: 100%;
    margin-bottom: 15px;
    overflow: hidden;
    border-radius: 8px;
}

.correlation-calculator .related-calc-image img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
}

.correlation-calculator .related-calc-card:hover .related-calc-image img {
    transform: scale(1.05);
}

.correlation-calculator .related-calc-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #374151;
}

.correlation-calculator .related-calc-desc {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 15px;
    flex-grow: 1;
}

.correlation-calculator .related-calc-cta {
    display: inline-block;
    background: #2563eb;
    color: white;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.3s ease;
}

.correlation-calculator .related-calc-card:hover .related-calc-cta {
    background: #1e40af;
}

/* Author Badge */
.correlation-calculator .calculator-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.correlation-calculator .author-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    border: 2px solid #e5e7eb;
}

.correlation-calculator .author-info {
    display: flex;
    flex-direction: column;
}

.correlation-calculator .author-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.correlation-calculator .author-name {
    font-weight: 600;
    color: #1f2937;
    text-decoration: none;
}

.correlation-calculator .author-name:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* ==========================================================================
   Accessibility - Reduced Motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .correlation-calculator .calculator-card,
    .correlation-calculator .educational-section,
    .correlation-calculator .faq-accordion .accordion-item,
    .correlation-calculator .related-calc-card {
        animation: none;
        opacity: 1;
    }

    .correlation-calculator .calculator-card:hover,
    .correlation-calculator .educational-section:hover,
    .correlation-calculator .faq-accordion .accordion-item:hover,
    .correlation-calculator .related-calc-card:hover {
        transform: none;
    }
}
