/**
 * Gordon Growth Model Calculator Styles
 *
 * All styles scoped to .ggm-calculator wrapper
 * to prevent conflicts with other calculators.
 *
 * @package Ryan_OConnell_Theme
 * @since 1.0.0
 */

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

.ggm-calculator {
    --ggm-primary: #2563eb;
    --ggm-primary-dark: #1e40af;
    --ggm-success: #15803d;
    --ggm-success-bg: #dcfce7;
    --ggm-warning: #eab308;
    --ggm-warning-bg: #fef9c3;
    --ggm-danger: #ef4444;
    --ggm-danger-bg: #fee2e2;
    --ggm-info: #0ea5e9;
    --ggm-info-bg: #e0f2fe;
}

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

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

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

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

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

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

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

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

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

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

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

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

.ggm-calculator .hero-section {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 3rem 0;
    margin-bottom: 0;
}

.ggm-calculator .hero-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: white !important;
}

.ggm-calculator .hero-section .lead {
    font-size: 1.25rem;
    opacity: 0.95;
}

.ggm-calculator .hero-section .text-white-50 {
    opacity: 0.7;
}

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

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

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

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

/* ==========================================================================
   Card Styles
   ========================================================================== */

.ggm-calculator .calculator-card {
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

.ggm-calculator .calculator-card .card-header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    font-weight: 600;
    padding: 1rem 1.25rem;
    border-bottom: none;
}

.ggm-calculator .calculator-card .card-header h2,
.ggm-calculator .calculator-card .card-header h3 {
    color: white;
    margin: 0;
}

.ggm-calculator .results-card .card-header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

/* ==========================================================================
   Mode Toggle (Radio Buttons)
   ========================================================================== */

.ggm-calculator .ggm-mode-toggle {
    display: flex;
    gap: 0.5rem;
    background: #f1f5f9;
    padding: 0.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.ggm-calculator .ggm-mode-option {
    flex: 1;
    text-align: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    border: 2px solid transparent;
    display: block;
}

.ggm-calculator .ggm-mode-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ggm-calculator .ggm-mode-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ggm-calculator .ggm-mode-title {
    font-weight: 700;
    font-size: 1rem;
    color: #64748b;
}

.ggm-calculator .ggm-mode-desc {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 500;
}

.ggm-calculator .ggm-mode-option:has(input:checked) {
    background: white;
    border-color: var(--ggm-primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.ggm-calculator .ggm-mode-option:has(input:checked) .ggm-mode-title {
    color: var(--ggm-primary);
}

.ggm-calculator .ggm-mode-option:has(input:checked) .ggm-mode-desc {
    color: var(--ggm-primary-dark);
}

.ggm-calculator .ggm-mode-option:has(input:focus) {
    outline: 2px solid var(--ggm-primary);
    outline-offset: 2px;
}

.ggm-calculator .ggm-mode-option:hover {
    background: rgba(255, 255, 255, 0.5);
}

.ggm-calculator .ggm-mode-option:hover .ggm-mode-title {
    color: var(--ggm-primary);
}

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

.ggm-calculator .form-control {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.ggm-calculator .form-control-lg {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
}

.ggm-calculator .input-group-text {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

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

.ggm-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #e5e7eb;
    color: #6b7280;
    border-radius: 50%;
    font-size: 11px;
    cursor: help;
    margin-left: 6px;
    position: relative;
}

.ggm-tooltip:hover::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;
    max-width: 280px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

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

.ggm-calculator .result-display {
    text-align: center;
    padding: 20px 0;
}

.ggm-calculator .result-value-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ggm-calculator .result-label {
    font-size: 0.875rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ggm-calculator .result-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--ggm-primary);
}

.ggm-calculator .metric-box {
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.ggm-calculator .metric-box strong {
    font-size: 1.25rem;
    color: var(--ggm-primary-dark);
}

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

.ggm-calculator .formula-display {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.25rem;
}

.ggm-calculator .formula-main {
    font-family: 'Courier New', Consolas, monospace;
    font-size: 1.1rem;
    color: var(--ggm-primary-dark);
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb;
    font-weight: 600;
}

.ggm-calculator .ggm-formula-step {
    display: flex;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.875rem;
}

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

.ggm-calculator .ggm-step-label {
    min-width: 180px;
    color: #6b7280;
    font-weight: 500;
}

.ggm-calculator .ggm-step-value {
    color: #1f2937;
    word-break: break-all;
    font-weight: 700;
}

/* ==========================================================================
   Sensitivity Table
   ========================================================================== */

.ggm-calculator .sensitivity-table {
    font-size: 0.8rem;
    border-collapse: collapse;
    width: 100%;
}

.ggm-calculator .sensitivity-table th,
.ggm-calculator .sensitivity-table td {
    text-align: center;
    padding: 0.5rem 0.375rem;
    border: 1px solid #e5e7eb;
    white-space: nowrap;
}

.ggm-calculator .sensitivity-table thead th {
    background: linear-gradient(135deg, var(--ggm-primary) 0%, var(--ggm-primary-dark) 100%);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.ggm-calculator .sensitivity-table .corner-cell {
    background: #f0f4ff;
    color: var(--ggm-primary-dark);
    font-weight: 700;
    font-size: 0.75rem;
}

.ggm-calculator .sensitivity-table .row-header {
    background: #f0f4ff;
    font-weight: 600;
    color: var(--ggm-primary-dark);
    text-align: right;
    padding-right: 0.75rem;
}

.ggm-calculator .sensitivity-table .current-cell {
    background: var(--ggm-primary);
    color: white;
    font-weight: 700;
    border-radius: 4px;
}

.ggm-calculator .sensitivity-table td.invalid-cell {
    background: #fef2f2;
    color: #ef4444;
    font-style: italic;
}

.ggm-calculator .sensitivity-table tbody tr:hover td:not(.row-header):not(.invalid-cell):not(.current-cell) {
    background: #eff6ff;
}

/* ==========================================================================
   Educational Section
   ========================================================================== */

.ggm-calculator .educational-section {
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
}

.ggm-calculator .educational-section .card-body {
    padding: 2rem;
}

.ggm-calculator .educational-section h2 {
    color: var(--ggm-primary-dark);
}

.ggm-calculator .educational-section h3 {
    color: #1f2937;
    font-size: 1.25rem;
}

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

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

.ggm-calculator .faq-accordion .accordion-button {
    font-weight: 600;
    color: #1f2937;
    background: #f9fafb;
    padding: 1rem 1.25rem;
}

.ggm-calculator .faq-accordion .accordion-button:not(.collapsed) {
    background: var(--ggm-primary);
    color: white;
    box-shadow: none;
}

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

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

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

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

.ggm-calculator .disclaimer h5 {
    color: #92400e;
    margin-bottom: 0.5rem;
}

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

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

.ggm-calculator .related-calc-card {
    display: block;
    text-align: center;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 25px 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    height: 100%;
}

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

.ggm-calculator .related-calc-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    background: linear-gradient(135deg, var(--ggm-primary) 0%, var(--ggm-primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ggm-calculator .related-calc-icon i {
    color: white;
    font-size: 1.5rem;
}

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

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

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

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

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

.ggm-calculator .related-calc-cta {
    display: inline-block;
    background: var(--ggm-primary);
    color: white;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s ease;
}

.ggm-calculator .related-calc-card:hover .related-calc-cta {
    background: var(--ggm-primary-dark);
}

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

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

.ggm-calculator .author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

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

.ggm-calculator .author-label {
    font-size: 0.75rem;
    color: #6b7280;
}

.ggm-calculator .author-name {
    font-weight: 600;
    color: var(--ggm-primary);
    text-decoration: none;
}

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

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

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

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

    .ggm-calculator .result-value {
        font-size: 2.5rem;
    }
}

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

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

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

    .ggm-calculator .ggm-formula-step {
        flex-direction: column;
        gap: 0.25rem;
    }

    .ggm-calculator .ggm-step-label {
        min-width: auto;
    }

    .ggm-calculator .educational-section .card-body {
        padding: 1.25rem;
    }

    .ggm-calculator .ggm-mode-toggle {
        flex-direction: column;
    }

    .ggm-calculator .ggm-mode-option {
        padding: 0.6rem 0.75rem;
    }

    .ggm-calculator .sensitivity-table {
        font-size: 0.7rem;
    }

    .ggm-calculator .sensitivity-table th,
    .ggm-calculator .sensitivity-table td {
        padding: 0.375rem 0.25rem;
    }
}

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

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

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

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

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

    .ggm-calculator .metric-box strong {
        font-size: 1rem;
    }
}

/* ==========================================================================
   Accessibility - Reduced Motion
   ========================================================================== */

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

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

/* ==========================================================================
   Screen Reader Only (Accessibility)
   ========================================================================== */

.ggm-calculator .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Video Embed
   ========================================================================== */

.ggm-calculator .video-embed {
    background: #f9fafb;
    border-radius: 0.75rem;
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
}

.ggm-calculator .video-embed h4 {
    color: #374151;
    font-weight: 600;
    font-size: 1rem;
}

.ggm-calculator .video-embed h4 i {
    color: var(--ggm-primary);
}

.ggm-calculator .video-embed .ratio {
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    background: #000;
}

.ggm-calculator .video-embed .ratio iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border: 0;
}

.ggm-calculator .video-embed .ratio .rll-youtube-player {
    position: absolute !important;
    inset: 0;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    padding-bottom: 0 !important;
    margin: 0 !important;
}

.ggm-calculator .video-embed .ratio .rll-youtube-player img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}
