/**
 * Calculator Hub - Modern UI Styles
 *
 * Styling for the /calculators/ archive page with glassmorphism,
 * animations, and modern interactive elements.
 *
 * @package Ryan_OConnell_Theme
 * @since 1.0.0
 */

/* ===========================
   CSS Variables
   =========================== */
:root {
    --calc-hub-primary: #2563eb;
    --calc-hub-primary-dark: #1e40af;
    --calc-hub-primary-light: #3b82f6;
    --calc-hub-gradient: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    --calc-hub-shadow: rgba(37, 99, 235, 0.15);
    --calc-hub-shadow-hover: rgba(37, 99, 235, 0.25);
    --calc-hub-text-dark: #1e293b;
    --calc-hub-text-muted: #64748b;
    --calc-hub-border: #e2e8f0;
    --calc-hub-bg-glass: rgba(255, 255, 255, 0.95);
    --calc-hub-card-radius: 16px;
    --calc-hub-transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ===========================
   Hero Section
   =========================== */
.calculators-hub {
    overflow-x: hidden;
}

.calc-hub-hero {
    position: relative;
    padding: 80px 0 60px;
    overflow: hidden;
}

.calc-hub-hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(-45deg, #2563eb, #1e40af, #3b82f6, #1d4ed8);
    background-size: 400% 400%;
    animation: gradientFlow 15s ease infinite;
    z-index: -1;
}

.calc-hub-hero-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.calc-hub-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.calc-hub-hero-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    animation: float 4s ease-in-out infinite;
}

.calc-hub-hero-title {
    font-size: 2.75rem;
    font-weight: 800;
    color: #ffffff !important;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calc-hub-hero-content p.calc-hub-hero-subtitle {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 auto 40px auto;
    line-height: 1.7;
    max-width: 600px;
    text-align: center;
}

/* ===========================
   Search Bar
   =========================== */
.calc-hub-search-wrap {
    position: relative;
    max-width: 500px;
    margin: 0 auto 28px;
}

.calc-hub-search-icon {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--calc-hub-text-muted);
    font-size: 1rem;
    transition: color 0.3s ease;
    z-index: 2;
}

.calc-hub-search-input {
    width: 100%;
    padding: 18px 50px 18px 56px;
    font-size: 1rem;
    background: var(--calc-hub-bg-glass);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    color: var(--calc-hub-text-dark);
    transition: var(--calc-hub-transition);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.calc-hub-search-input::placeholder {
    color: var(--calc-hub-text-muted);
}

.calc-hub-search-input:focus {
    outline: none;
    border-color: white;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2), 0 8px 30px rgba(0, 0, 0, 0.15);
    transform: scale(1.02);
}

.calc-hub-search-input:focus + .calc-hub-search-icon,
.calc-hub-search-wrap:focus-within .calc-hub-search-icon {
    color: var(--calc-hub-primary);
}

.calc-hub-search-clear {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--calc-hub-border);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--calc-hub-text-muted);
    transition: all 0.3s ease;
    z-index: 2;
}

.calc-hub-search-clear:hover {
    background: var(--calc-hub-primary);
    color: white;
}

.calc-hub-search-clear.hidden {
    display: none;
}

/* ===========================
   Filter Tabs
   =========================== */
.calc-hub-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.calc-hub-filter {
    padding: 12px 24px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: #1a1a1a;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--calc-hub-transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Link-specific styles to override browser defaults */
a.calc-hub-filter,
a.calc-hub-filter:link,
a.calc-hub-filter:visited {
    color: #1a1a1a;
    text-decoration: none;
}

a.calc-hub-filter:hover {
    color: #1a1a1a;
    text-decoration: none;
}

a.calc-hub-filter.active,
a.calc-hub-filter.active:link,
a.calc-hub-filter.active:visited {
    color: var(--calc-hub-primary-dark);
}

.calc-hub-filter:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.calc-hub-filter.active {
    background: white;
    color: var(--calc-hub-primary-dark);
    border-color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.calc-hub-filter .count {
    background: rgba(0, 0, 0, 0.1);
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 700;
}

.calc-hub-filter.active .count {
    background: var(--calc-hub-primary);
    color: white;
}

/* ===========================
   Results Bar
   =========================== */
.calc-hub-results-bar {
    padding: 24px 0 8px;
}

.calc-hub-results {
    color: var(--calc-hub-text-muted);
    font-size: 0.95rem;
    margin: 0;
}

.calc-hub-results span {
    color: var(--calc-hub-text-dark);
    font-weight: 600;
}

/* ===========================
   Card Grid
   =========================== */
.calc-hub-grid-section {
    padding: 20px 0 60px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    min-height: 400px;
}

.calc-hub-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

/* ===========================
   Calculator Cards
   =========================== */
.calc-hub-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
    transition: var(--calc-hub-transition);
}

.calc-hub-card.hidden {
    display: none !important;
}

.calc-hub-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--calc-hub-bg-glass);
    backdrop-filter: blur(10px);
    border: 2px solid var(--calc-hub-border);
    border-radius: var(--calc-hub-card-radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: var(--calc-hub-transition);
}

.calc-hub-card-link:hover {
    transform: translateY(-8px);
    border-color: var(--calc-hub-primary);
    box-shadow: 0 20px 40px var(--calc-hub-shadow-hover);
    text-decoration: none;
    color: inherit;
}

/* Card Image - 3:2 aspect ratio to match 1152x768 images */
.calc-hub-card-image {
    position: relative;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.calc-hub-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.calc-hub-card-link:hover .calc-hub-card-image img {
    transform: scale(1.08);
}

.calc-hub-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--calc-hub-primary);
    opacity: 0.3;
}

.calc-hub-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.02) 100%);
    pointer-events: none;
}

/* Card Badges */
.calc-hub-card-badges {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    z-index: 2;
}

.calc-hub-card-badges .badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calc-hub-card-badges .badge.category {
    background: var(--calc-hub-gradient);
    color: white;
    box-shadow: 0 2px 8px var(--calc-hub-shadow);
}

.calc-hub-card-badges .badge.popular {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.calc-hub-card-badges .badge.new {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

/* Card Body */
.calc-hub-card-body {
    padding: 16px;
    flex: 1;
}

.calc-hub-card-title {
    font-size: 1.0rem !important;
    font-weight: 600 !important;
    color: var(--calc-hub-text-dark);
    margin: 0 0 6px 0;
    line-height: 1.25 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.calc-hub-card-link:hover .calc-hub-card-title {
    color: var(--calc-hub-primary);
}

.calc-hub-card-desc {
    font-size: 0.85rem;
    color: var(--calc-hub-text-muted);
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Footer */
.calc-hub-card-footer {
    padding: 0 16px 16px;
}

.calc-hub-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 20px;
    background: var(--calc-hub-gradient);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--calc-hub-transition);
    box-shadow: 0 4px 15px var(--calc-hub-shadow);
}

.calc-hub-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 20px var(--calc-hub-shadow-hover);
}

.calc-hub-btn i {
    font-size: 0.85rem;
    transition: transform 0.3s ease;
}

.calc-hub-card-link:hover .calc-hub-btn i {
    transform: translateX(4px);
}

/* ===========================
   Empty State
   =========================== */
.calc-hub-empty {
    text-align: center;
    padding: 80px 20px;
}

.calc-hub-empty.hidden {
    display: none;
}

.calc-hub-empty-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    background: var(--calc-hub-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--calc-hub-text-muted);
}

.calc-hub-empty-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--calc-hub-text-dark);
    margin: 0 0 12px 0;
}

.calc-hub-empty-text {
    font-size: 1rem;
    color: var(--calc-hub-text-muted);
    margin: 0 0 24px 0;
}

.calc-hub-empty .calc-hub-btn {
    width: auto;
    display: inline-flex;
}

/* ===========================
   Bottom CTA Section
   =========================== */
.calc-hub-cta {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 60px 0;
    border-top: 1px solid var(--calc-hub-border);
}

.calc-hub-cta-content {
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.calc-hub-cta-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--calc-hub-text-dark);
    margin: 0 0 12px 0;
}

.calc-hub-cta-content p {
    font-size: 1rem;
    color: var(--calc-hub-text-muted);
    margin: 0 0 24px 0;
}

.calc-hub-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    background: white;
    color: var(--calc-hub-primary);
    border: 2px solid var(--calc-hub-primary);
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--calc-hub-transition);
}

.calc-hub-cta-btn:hover {
    background: var(--calc-hub-primary);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--calc-hub-shadow);
}

/* ===========================
   Responsive Design
   =========================== */

/* Tablet */
@media (max-width: 991px) {
    .calc-hub-hero {
        padding: 60px 0 50px;
    }

    .calc-hub-hero-title {
        font-size: 2.25rem;
    }

    .calc-hub-hero-content p.calc-hub-hero-subtitle {
        font-size: 1rem;
    }

    .calc-hub-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .calc-hub-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .calc-hub-filters::-webkit-scrollbar {
        display: none;
    }

    .calc-hub-filter {
        flex-shrink: 0;
    }
}

/* Mobile */
@media (max-width: 576px) {
    .calc-hub-hero {
        padding: 50px 0 40px;
    }

    .calc-hub-hero-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    .calc-hub-hero-title {
        font-size: 1.75rem;
    }

    .calc-hub-hero-content p.calc-hub-hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: 24px;
    }

    .calc-hub-search-input {
        padding: 14px 45px 14px 48px;
        font-size: 0.95rem;
    }

    .calc-hub-search-icon {
        left: 18px;
    }

    .calc-hub-filter {
        padding: 10px 18px;
        font-size: 0.85rem;
    }

    .calc-hub-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Keep aspect ratio on mobile too */
    .calc-hub-card-image {
        aspect-ratio: 3 / 2;
    }

    .calc-hub-card-title {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }

    .calc-hub-btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }

    .calc-hub-cta {
        padding: 40px 0;
    }

    .calc-hub-cta-content h2 {
        font-size: 1.25rem;
    }
}

/* ===========================
   Accessibility
   =========================== */
@media (prefers-reduced-motion: reduce) {
    .calc-hub-card,
    .calc-hub-hero-icon,
    .calc-hub-hero-bg {
        animation: none;
    }

    .calc-hub-card {
        opacity: 1;
    }

    .calc-hub-card-link:hover,
    .calc-hub-btn:hover,
    .calc-hub-filter:hover {
        transform: none;
    }
}

/* Focus States */
.calc-hub-filter:focus,
.calc-hub-btn:focus,
.calc-hub-cta-btn:focus {
    outline: 2px solid var(--calc-hub-primary);
    outline-offset: 2px;
}

.calc-hub-card-link:focus {
    outline: none;
}

.calc-hub-card-link:focus-visible {
    outline: 2px solid var(--calc-hub-primary);
    outline-offset: 4px;
}

/* ===========================
   CTA Buttons Container
   =========================== */
.calc-hub-cta-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

/* ===========================
   Contact Modal
   =========================== */
.calc-hub-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.calc-hub-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.calc-hub-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.calc-hub-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease;
}

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

.calc-hub-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.calc-hub-modal-close:hover {
    color: #1e293b;
}

.calc-hub-modal-content h3 {
    margin: 0 0 24px 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--calc-hub-text-dark);
}

/* Fluent Form styling inside modal */
.calc-hub-modal-content .fluentform {
    margin: 0;
}

.calc-hub-modal-content .ff-el-form-control {
    border-radius: 8px;
}

.calc-hub-modal-content .ff-btn-submit {
    background: var(--calc-hub-gradient) !important;
    border-radius: 25px !important;
    padding: 12px 28px !important;
    font-weight: 600 !important;
}
