/* ==========================================================================
   Calculator Catalog Page Styles
   ========================================================================== */

/* Calculator Header Section - Ultra Compact */
.calc-header-section {
    padding: calc(80px + 1rem) 0 1.5rem 0;
    background: linear-gradient(135deg, #F5F7FA 0%, #E3E8EF 100%);
    position: relative;
}

.calc-header-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(33, 150, 243, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(33, 150, 243, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
}

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

.calc-header-content h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.calc-header-content p {
    font-size: 0.9375rem;
    color: var(--dark-600);
    margin-bottom: 1rem;
}

.highlight {
    color: var(--primary);
    font-weight: 700;
}

/* Search Container - Compact */
.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto 0.75rem auto;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dark-600);
    z-index: 1;
}

#searchInput {
    width: 100%;
    padding: 0.625rem 0.75rem 0.625rem 2.5rem;
    border: 2px solid var(--light);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-family: var(--font-family);
    background: var(--white);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

/* Category Filters - Compact */
.category-filters {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 0.875rem;
    border: 2px solid var(--light);
    border-radius: var(--radius-lg);
    background: var(--white);
    color: var(--dark-700);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.filter-btn .count {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
}

.filter-btn.active .count {
    background: rgba(255, 255, 255, 0.2);
}

/* Calculators Section - Compact */
.calculators-section {
    padding: 1.5rem 0 2rem 0;
    background: var(--white);
}

.result-count {
    text-align: center;
    font-size: 0.875rem;
    color: var(--dark-600);
    margin-bottom: 1.25rem;
    font-weight: 500;
}

#countNumber {
    color: var(--primary);
    font-weight: 700;
}

/* Category Section - Compact */
.category-section {
    margin-bottom: 2rem;
}

.category-section.hidden {
    display: none;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.875rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light);
}

.category-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

/* Calculators Grid - Tighter Spacing */
.calculators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.875rem;
}

/* Calculator Card - Compact */
.calc-card {
    background: var(--white);
    border: 2px solid var(--light);
    border-radius: var(--radius-lg);
    padding: 0.875rem;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: block;
    color: inherit;
}

.calc-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(33, 150, 243, 0.05) 0%, transparent 70%);
    transform: translate(30%, -30%);
    transition: var(--transition);
}

.calc-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.calc-card:hover::before {
    transform: translate(20%, -20%) scale(1.2);
}

.calc-card.hidden {
    display: none;
}

.calc-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 0.625rem;
    box-shadow: var(--shadow-sm);
}

.calc-card-icon.blue { background: linear-gradient(135deg, #2196F3, #1976D2); }
.calc-card-icon.green { background: linear-gradient(135deg, #4CAF50, #388E3C); }
.calc-card-icon.orange { background: linear-gradient(135deg, #FF9800, #F57C00); }
.calc-card-icon.red { background: linear-gradient(135deg, #F44336, #D32F2F); }
.calc-card-icon.purple { background: linear-gradient(135deg, #9C27B0, #7B1FA2); }
.calc-card-icon.teal { background: linear-gradient(135deg, #00BCD4, #0097A7); }
.calc-card-icon.cyan { background: linear-gradient(135deg, #00BCD4, #0097A7); }
.calc-card-icon.indigo { background: linear-gradient(135deg, #3F51B5, #303F9F); }
.calc-card-icon.pink { background: linear-gradient(135deg, #E91E63, #C2185B); }
.calc-card-icon.amber { background: linear-gradient(135deg, #FFC107, #FFA000); }
.calc-card-icon.brown { background: linear-gradient(135deg, #795548, #5D4037); }
.calc-card-icon.gray { background: linear-gradient(135deg, #607D8B, #455A64); }
.calc-card-icon.yellow { background: linear-gradient(135deg, #FFEB3B, #FBC02D); }

.calc-card h3 {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.375rem;
    line-height: 1.3;
}

.calc-card > p {
    color: var(--dark-600);
    line-height: 1.5;
    margin-bottom: 0.625rem;
    font-size: 0.8125rem;
}

/* Calculator Tags */
.calc-tags {
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
}

/* No Results */
.no-results {
    text-align: center;
    padding: var(--spacing-3xl) 0;
}

.no-results svg {
    margin-bottom: var(--spacing-lg);
}

.no-results h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: var(--spacing-sm);
}

.no-results p {
    font-size: 1.125rem;
    color: var(--dark-600);
}

/* Active Navigation Link */
.nav-menu a.active {
    color: var(--primary);
}

.nav-menu a.active::after {
    width: 100%;
}

/* Responsive Design - Maintains Compact Look */
@media (max-width: 1024px) {
    .calculators-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .calc-header-content h1 {
        font-size: 1.75rem;
    }

    .calc-header-content p {
        font-size: 0.875rem;
    }

    .category-filters {
        gap: 0.375rem;
    }

    .filter-btn {
        padding: 0.4375rem 0.75rem;
        font-size: 0.75rem;
    }

    .category-title {
        font-size: 1.125rem;
    }

    .calculators-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .calc-header-content h1 {
        font-size: 1.5rem;
    }

    .calc-header-content p {
        font-size: 0.8125rem;
    }

    .category-filters {
        flex-direction: column;
    }

    .filter-btn {
        width: 100%;
        justify-content: space-between;
    }

    .category-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.375rem;
    }
}

/* Animation for Calculator Cards - Disabled for performance */
/* Cards now show immediately without animation for faster loading */

/* Performance Optimization - Removed content-visibility for faster initial render */

/* Loading state (for future use) */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading .calc-card {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ==========================================================================
   Data Table Styles - Enhanced for Number Readability
   ========================================================================== */

/* Table Container */
.calc-card table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Table Headers */
.calc-card table thead {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.calc-card table thead tr {
    border-bottom: 2px solid var(--primary);
}

.calc-card table th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--dark);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    white-space: nowrap;
}

/* Table Body */
.calc-card table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.15s ease;
}

.calc-card table tbody tr:last-child {
    border-bottom: none;
}

/* Zebra Striping for Better Readability */
.calc-card table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.calc-card table tbody tr:hover {
    background-color: #e3f2fd;
}

/* Table Cells */
.calc-card table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--dark-700);
    vertical-align: middle;
}

/* First Column (Labels) - Left Aligned */
.calc-card table td:first-child,
.calc-card table th:first-child {
    font-weight: 600;
    color: var(--dark);
}

/* Numerical Columns - Right Aligned with Monospace Font */
.calc-card table td:not(:first-child),
.calc-card table th:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
}

/* Special Handling for Text in Non-First Columns (like units or formulas) */
.calc-card table td:not(:first-child):not([data-numeric]) {
    white-space: nowrap;
}

/* Add Visual Breathing Room */
.calc-card table td {
    min-width: 80px;
}

/* Numeric Emphasis - Make numbers stand out */
.calc-card table td:not(:first-child) {
    font-weight: 500;
    color: #1a1a1a;
}

/* Notes Below Tables */
.calc-card .note,
.calc-card p.note {
    font-size: 0.8125rem;
    color: var(--dark-600);
    font-style: italic;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    border-radius: var(--radius-sm);
}

/* Responsive Table Design */
@media (max-width: 768px) {
    .calc-card table {
        font-size: 0.8125rem;
    }

    .calc-card table th,
    .calc-card table td {
        padding: 0.625rem 0.75rem;
    }

    /* Allow horizontal scrolling on mobile for wide tables */
    .calc-card {
        overflow-x: auto;
    }

    .calc-card table {
        min-width: 100%;
        width: max-content;
    }
}

@media (max-width: 480px) {
    .calc-card table th,
    .calc-card table td {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }

    .calc-card table th {
        font-size: 0.6875rem;
    }
}
