/**
 * Logit & Probit Calculator Styles
 *
 * All styles scoped to .lgp-calculator wrapper
 * to prevent conflicts with other calculators.
 *
 * @package Ryan_OConnell_Theme
 * @since 1.0.0
 */

/* ==========================================================================
   CSS Variables (Scoped to wrapper)
   ========================================================================== */

.lgp-calculator {
    --lgp-primary: #2563eb;
    --lgp-primary-dark: #1e40af;
    --lgp-primary-light: #dbeafe;
    --lgp-above-threshold: #15803d;
    --lgp-above-threshold-bg: #dcfce7;
    --lgp-below-threshold: #dc2626;
    --lgp-below-threshold-bg: #fee2e2;
    --lgp-neutral: #6b7280;
    --lgp-neutral-bg: #f3f4f6;
}

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

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

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

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

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

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

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

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

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

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

/* ==========================================================================
   Hero Section
   ========================================================================== */

.lgp-calculator .hero-section {
    background: linear-gradient(135deg, var(--lgp-primary) 0%, var(--lgp-primary-dark) 100%);
    padding: 3rem 0;
    color: white;
}

.lgp-calculator .hero-section h1 {
    font-weight: 700;
    font-size: 2.5rem;
    color: white;
}

.lgp-calculator .hero-section .lead {
    font-size: 1.25rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
}

/* ==========================================================================
   Breadcrumb
   ========================================================================== */

.lgp-calculator .breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

.lgp-calculator .breadcrumb-item a {
    color: var(--lgp-primary);
    text-decoration: none;
}

.lgp-calculator .breadcrumb-item a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.lgp-calculator .calculator-card {
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

.lgp-calculator .calculator-card .card-header {
    background: linear-gradient(135deg, var(--lgp-primary) 0%, var(--lgp-primary-dark) 100%);
    color: white;
    border-bottom: none;
    padding: 1rem 1.25rem;
}

.lgp-calculator .calculator-card .card-header h2,
.lgp-calculator .calculator-card .card-header h3 {
    color: white;
}

.lgp-calculator .calculator-card .card-body {
    padding: 1.5rem;
}

/* ==========================================================================
   Form Inputs
   ========================================================================== */

.lgp-calculator .form-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lgp-calculator .form-control,
.lgp-calculator .form-select {
    border-radius: 8px;
    border: 1px solid #d1d5db;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lgp-calculator .form-control:focus,
.lgp-calculator .form-select:focus {
    border-color: var(--lgp-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ==========================================================================
   Tooltip
   ========================================================================== */

.lgp-calculator .lgp-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--lgp-primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    position: relative;
    flex-shrink: 0;
    border: none;
    padding: 0;
    line-height: 1;
}

.lgp-calculator .lgp-tooltip:focus {
    outline: 2px solid var(--lgp-primary);
    outline-offset: 2px;
}

.lgp-calculator .lgp-tooltip:hover::after,
.lgp-calculator .lgp-tooltip:focus::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    white-space: normal;
    width: 220px;
    z-index: 10;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.lgp-calculator .lgp-tooltip:hover::before,
.lgp-calculator .lgp-tooltip:focus::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1f2937;
    z-index: 10;
}

/* ==========================================================================
   Results Display
   ========================================================================== */

.lgp-calculator .result-value {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    transition: color 0.3s ease;
}

.lgp-calculator .probability-above {
    color: var(--lgp-above-threshold);
}

.lgp-calculator .probability-below {
    color: var(--lgp-below-threshold);
}

.lgp-calculator .model-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--lgp-primary-light);
    color: var(--lgp-primary-dark);
}

/* Secondary Results */
.lgp-calculator .secondary-result {
    text-align: center;
    padding: 0.75rem 0.5rem;
}

.lgp-calculator .secondary-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.lgp-calculator .secondary-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* ==========================================================================
   Warning and Info Boxes
   ========================================================================== */

.lgp-calculator .warning-box {
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: #92400e;
    font-size: 0.875rem;
}

.lgp-calculator .info-box {
    background: var(--lgp-primary-light);
    border: 1px solid var(--lgp-primary);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--lgp-primary-dark);
    font-size: 0.875rem;
}

/* ==========================================================================
   Chart Container
   ========================================================================== */

.lgp-calculator .chart-container {
    position: relative;
    height: 320px;
    width: 100%;
}

.lgp-calculator .chart-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.75rem;
}

.lgp-calculator .chart-controls label {
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================================================
   Formula Display
   ========================================================================== */

.lgp-calculator .formula-display {
    background: var(--lgp-neutral-bg);
    border-radius: 8px;
    padding: 1.25rem;
}

.lgp-calculator .formula-main {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.lgp-calculator .formula-secondary {
    font-size: 0.875rem;
    color: #6b7280;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.lgp-calculator .formula-legend {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* ==========================================================================
   Model Assumptions Table
   ========================================================================== */

.lgp-calculator .assumptions-table {
    font-size: 0.875rem;
}

.lgp-calculator .assumptions-table td {
    padding: 0.5rem 0.75rem;
    vertical-align: top;
    border-bottom: 1px solid #f3f4f6;
}

.lgp-calculator .assumptions-table tr:nth-child(even) td {
    background: #f9fafb;
}

.lgp-calculator .assumptions-table .assumption-num {
    font-weight: 700;
    color: var(--lgp-primary);
    width: 30px;
}

/* ==========================================================================
   FAQ Accordion
   ========================================================================== */

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

.lgp-calculator .faq-accordion .accordion-button {
    font-weight: 600;
    font-size: 0.95rem;
    color: #374151;
    background: white;
    border-radius: 8px !important;
}

.lgp-calculator .faq-accordion .accordion-button:not(.collapsed) {
    background: linear-gradient(135deg, var(--lgp-primary) 0%, var(--lgp-primary-dark) 100%);
    color: white;
    box-shadow: none;
}

.lgp-calculator .faq-accordion .accordion-button:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.lgp-calculator .faq-accordion .accordion-button:not(.collapsed)::after {
    filter: brightness(0) invert(1);
}

.lgp-calculator .faq-accordion .accordion-body {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #4b5563;
}

/* ==========================================================================
   Disclaimer
   ========================================================================== */

.lgp-calculator .disclaimer {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 1.25rem;
}

.lgp-calculator .disclaimer h5 {
    color: #92400e;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.lgp-calculator .disclaimer p {
    color: #78350f;
    font-size: 0.875rem;
    margin-bottom: 0;
    line-height: 1.6;
}

/* ==========================================================================
   Related Calculators
   ========================================================================== */

.lgp-calculator .related-calc-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    padding: 1.5rem;
}

.lgp-calculator .related-calc-card:hover {
    border-color: var(--lgp-primary);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.1);
    transform: translateY(-4px);
    text-decoration: none;
    color: inherit;
}

.lgp-calculator .related-calc-image {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

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

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

.lgp-calculator .related-calc-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--lgp-primary) 0%, var(--lgp-primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: white;
    font-size: 1.5rem;
}

.lgp-calculator .related-calc-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.lgp-calculator .related-calc-desc {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.lgp-calculator .related-calc-cta {
    color: var(--lgp-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

/* ==========================================================================
   Author Badge
   ========================================================================== */

.lgp-calculator .author-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lgp-calculator .author-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--lgp-primary);
}

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

.lgp-calculator .author-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1f2937;
}

.lgp-calculator .author-name a {
    color: var(--lgp-primary);
    text-decoration: none;
}

.lgp-calculator .author-name a:hover {
    text-decoration: underline;
}

.lgp-calculator .author-title {
    font-size: 0.8rem;
    color: #6b7280;
}

/* ==========================================================================
   Responsive: Tablet (max-width: 991px)
   ========================================================================== */

@media (max-width: 991px) {
    .lgp-calculator .hero-section {
        padding: 2rem 0;
    }

    .lgp-calculator .hero-section h1 {
        font-size: 2rem;
    }

    .lgp-calculator .result-value {
        font-size: 2rem;
    }

    .lgp-calculator .secondary-value {
        font-size: 1rem;
    }

    .lgp-calculator .chart-container {
        height: 280px;
    }
}

/* ==========================================================================
   Responsive: Mobile Landscape (max-width: 767px)
   ========================================================================== */

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

    .lgp-calculator .hero-section .lead {
        font-size: 1rem;
    }

    .lgp-calculator .result-value {
        font-size: 1.75rem;
    }

    .lgp-calculator .chart-container {
        height: 260px;
    }
}

/* ==========================================================================
   Responsive: Mobile Portrait (max-width: 576px)
   ========================================================================== */

@media (max-width: 576px) {
    .lgp-calculator .hero-section {
        padding: 1.5rem 0;
    }

    .lgp-calculator .hero-section h1 {
        font-size: 1.5rem;
    }

    .lgp-calculator .calculator-card .card-body {
        padding: 1rem;
    }

    .lgp-calculator .result-value {
        font-size: 1.5rem;
    }

    .lgp-calculator .secondary-value {
        font-size: 0.9rem;
    }

    .lgp-calculator .secondary-label {
        font-size: 0.65rem;
    }

    .lgp-calculator .chart-container {
        height: 220px;
    }

    .lgp-calculator .related-calc-card {
        padding: 1rem;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .lgp-calculator .calculator-card,
    .lgp-calculator .educational-section,
    .lgp-calculator .faq-accordion .accordion-item,
    .lgp-calculator .related-calc-card {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .lgp-calculator .calculator-card:hover,
    .lgp-calculator .educational-section:hover,
    .lgp-calculator .related-calc-card:hover {
        transform: none;
    }
}
