/* ================================================
   CalcHub - Professional Calculator Website
   Modern UI/UX with Animations
   ================================================ */

/* ==================== CSS Variables ==================== */
:root {
    /* Colors */
    --color-primary: #667eea;
    --color-primary-dark: #5a6fd6;
    --color-secondary: #764ba2;
    --color-accent: #00d4aa;
    --color-accent-glow: rgba(0, 212, 170, 0.4);

    /* Background */
    --bg-dark: #0a0a0f;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.1);
    --bg-glass: rgba(255, 255, 255, 0.08);
    --bg-modal: rgba(15, 15, 25, 0.98);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);

    /* Borders */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-glow: rgba(102, 126, 234, 0.5);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-accent: linear-gradient(135deg, #00d4aa 0%, #00b894 100%);
    --gradient-card: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);

    /* Shadows */
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(102, 126, 234, 0.3);

    /* Spacing */
    --container-max: 1400px;
    --header-height: 80px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
}

/* ==================== Ad Popup Overlay ==================== */
.ad-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.ad-popup-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.ad-popup {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.ad-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--gradient-primary);
    color: white;
}

.ad-timer {
    font-size: 14px;
    font-weight: 600;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
}

.ad-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 18px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.ad-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.ad-content {
    padding: 20px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    background: #fff;
}

.adsterra-popup-ad {
    width: 160px;
    height: 300px;
    overflow: hidden;
    border-radius: 8px;
}

/* ==================== Reset & Base ==================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

::selection {
    background: var(--color-primary);
    color: white;
}

/* ==================== Background Animation ==================== */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.bg-gradient {
    position: absolute;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(118, 75, 162, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(0, 212, 170, 0.05) 0%, transparent 50%);
    animation: bgPulse 10s ease-in-out infinite;
}

@keyframes bgPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.bg-particles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--color-accent);
    border-radius: 50%;
    opacity: 0.3;
    animation: float 20s infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 0.3;
    }

    90% {
        opacity: 0.3;
    }

    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ==================== Container ==================== */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

/* ==================== Header ==================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #0a0a0f;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: var(--transition-normal);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    gap: 24px;
    padding: 0 24px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 32px;
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.logo-accent {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Search */
.search-container {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition-fast);
}

.search-input {
    width: 100%;
    padding: 12px 80px 12px 48px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition-normal);
}

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

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--bg-card-hover);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.search-input:focus+.search-icon,
.search-input:focus~.search-icon {
    color: var(--color-primary);
}

.search-kbd {
    position: absolute;
    right: 12px;
    padding: 4px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
    pointer-events: none;
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition-normal);
    box-shadow: var(--shadow-lg);
}

.search-results.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-card-hover);
}

.search-result-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-category {
    font-size: 13px;
    color: var(--text-muted);
}

.search-no-results {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
}

/* Navigation */
.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

/* Popular Dropdown */
.nav-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.popular-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 420px;
    max-height: 500px;
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition-normal);
    z-index: 1001;
    overflow: hidden;
}

.popular-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.popular-dropdown-header {
    padding: 16px 20px;
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    font-size: 15px;
    text-align: center;
}

.popular-dropdown-grid {
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.popular-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.popular-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--color-primary);
    transform: translateX(4px);
}

.popular-item-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.popular-item-info {
    flex: 1;
    min-width: 0;
}

.popular-item-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.popular-item-category {
    font-size: 12px;
    color: var(--text-muted);
}

.popular-item-badge {
    padding: 4px 8px;
    background: var(--gradient-accent);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: #0a0a0f;
    flex-shrink: 0;
}

/* ==================== Hero Section ==================== */
.hero {
    padding: 160px 0 80px;
    text-align: center;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    margin-bottom: 24px;
}

.hero-title-line {
    display: block;
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 600;
    color: var(--text-secondary);
    animation: fadeInUp 0.6s ease forwards;
}

.hero-title-gradient {
    display: block;
    font-size: clamp(48px, 8vw, 80px);
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -2px;
    animation: fadeInUp 0.6s ease 0.1s forwards;
    opacity: 0;
}

.hero-subtitle {
    font-size: clamp(16px, 2vw, 20px);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 48px;
    animation: fadeInUp 0.6s ease 0.2s forwards;
    opacity: 0;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    animation: fadeInUp 0.6s ease 0.3s forwards;
    opacity: 0;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 48px;
    font-weight: 800;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== Section Title ==================== */
.section-title {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 700;
    margin-bottom: 40px;
    text-align: center;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== Categories ==================== */
.categories {
    padding: 40px 0 80px;
    position: relative;
    z-index: 1;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.category-card {
    position: relative;
    z-index: 1;
    padding: 32px;
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition-normal);
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition-normal);
}

.category-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.category-card:hover::before {
    opacity: 0.1;
}

.category-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: inline-block;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.category-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.category-count {
    font-size: 14px;
    color: var(--text-muted);
}

.category-arrow {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-normal);
}

.category-arrow svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: var(--transition-normal);
}

.category-card:hover .category-arrow {
    background: var(--gradient-primary);
}

.category-card:hover .category-arrow svg {
    color: white;
    transform: translateX(4px);
}

/* ==================== Calculator List ==================== */
.calculator-list {
    padding: 120px 0 80px;
    display: none;
}

.calculator-list.active {
    display: block;
}

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 16px;
}

.list-header .section-title {
    margin-bottom: 0;
    text-align: left;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-back svg {
    width: 18px;
    height: 18px;
}

.btn-back:hover {
    background: var(--bg-card-hover);
    border-color: var(--color-primary);
    color: var(--text-primary);
}

.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.calculator-card {
    position: relative;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-normal);
    overflow: hidden;
}

.calculator-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition-normal);
}

.calculator-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--color-primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.calculator-card:hover::before {
    opacity: 1;
}

.calculator-card-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.calculator-card-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.calculator-card-info {
    flex: 1;
    min-width: 0;
}

.calculator-card-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

.calculator-card-category {
    font-size: 13px;
    color: var(--text-muted);
}

/* ==================== Modal ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-title-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-icon {
    font-size: 28px;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.modal-close:hover {
    background: rgba(255, 100, 100, 0.2);
    border-color: #ff6464;
}

.modal-close:hover svg {
    color: #ff6464;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    transition: var(--transition-fast);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.form-select {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
}

.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.form-select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.btn-calculate {
    width: 100%;
    padding: 16px 24px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn-calculate::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.btn-calculate:hover::before {
    width: 400px;
    height: 400px;
}

.btn-calculate:active {
    transform: translateY(0);
}

/* Result Section */
.modal-result {
    padding: 24px;
    background: var(--gradient-card);
    border-top: 1px solid var(--border-color);
    text-align: center;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-label {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.result-value {
    font-size: 36px;
    font-weight: 800;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    animation: countUp 0.5s ease;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-details {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.result-details p {
    margin: 4px 0;
}

/* ==================== Footer ==================== */
.footer {
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-text {
    color: var(--text-muted);
    font-size: 14px;
}

.footer-copyright {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 8px;
    opacity: 0.7;
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* ==================== Responsive ==================== */
/* Large Desktop */
@media (min-width: 1200px) {
    .category-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Desktop */
@media (max-width: 1199px) and (min-width: 992px) {
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet Landscape */
@media (max-width: 991px) and (min-width: 769px) {
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .calculator-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet Portrait and below */
@media (max-width: 768px) {
    :root {
        --header-height: auto;
    }

    .header-content {
        flex-wrap: wrap;
        padding: 12px 0;
        height: auto;
        gap: 12px;
    }

    .logo {
        order: 1;
        flex: 1;
    }

    .nav-links {
        order: 2;
        gap: 4px;
    }

    .nav-link {
        padding: 6px 10px;
        font-size: 12px;
    }

    .search-container {
        order: 3;
        max-width: 100%;
        width: 100%;
    }

    .search-kbd {
        display: none;
    }

    .search-input {
        padding: 10px 16px 10px 40px;
        font-size: 14px;
    }

    .hero {
        padding: 120px 0 40px;
    }

    .hero-subtitle {
        font-size: 16px;
        margin-bottom: 32px;
    }

    .hero-stats {
        gap: 20px;
        flex-wrap: wrap;
    }

    .stat-number {
        font-size: 32px;
    }

    .stat-label {
        font-size: 12px;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .category-card {
        padding: 20px;
    }

    .category-icon {
        font-size: 36px;
        margin-bottom: 12px;
    }

    .category-name {
        font-size: 16px;
    }

    .category-count {
        font-size: 12px;
    }

    .category-arrow {
        width: 32px;
        height: 32px;
        bottom: 16px;
        right: 16px;
    }

    .category-arrow svg {
        width: 16px;
        height: 16px;
    }

    .calculator-grid {
        grid-template-columns: 1fr;
    }

    .section-title {
        font-size: 24px;
        margin-bottom: 24px;
    }

    .list-header {
        flex-direction: column;
        align-items: stretch;
    }

    .list-header .section-title {
        text-align: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal {
        max-height: 95vh;
        margin: 0;
        border-radius: var(--radius-lg);
    }

    .modal-overlay {
        padding: 16px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .logo-text {
        font-size: 20px;
    }

    .logo-icon {
        font-size: 28px;
    }

    .nav-links {
        display: none;
    }

    .hero {
        padding: 100px 0 30px;
    }

    .hero-title-gradient {
        font-size: 36px;
        letter-spacing: -1px;
    }

    .hero-title-line {
        font-size: 24px;
    }

    .hero-stats {
        justify-content: center;
        gap: 16px;
    }

    .stat {
        min-width: 70px;
    }

    .stat-number {
        font-size: 28px;
    }

    .category-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .category-card {
        padding: 16px;
        display: flex;
        align-items: center;
        gap: 16px;
    }

    .category-icon {
        font-size: 32px;
        margin-bottom: 0;
    }

    .category-info {
        flex: 1;
    }

    .category-arrow {
        position: static;
        flex-shrink: 0;
    }

    .calculator-card {
        padding: 16px;
    }

    .calculator-card-icon {
        font-size: 28px;
    }

    .calculator-card-name {
        font-size: 14px;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-title {
        font-size: 16px;
    }

    .modal-icon {
        font-size: 24px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-result {
        padding: 16px;
    }

    .result-value {
        font-size: 28px;
    }

    .btn-calculate {
        padding: 14px;
        font-size: 14px;
    }

    .form-input,
    .form-select {
        padding: 12px 14px;
        font-size: 14px;
    }

    .footer {
        padding: 24px 0;
    }

    .footer-text {
        font-size: 12px;
    }

    .footer-copyright {
        font-size: 11px;
    }
}

.category-card:nth-child(1) {
    animation-delay: 0.05s;
}

.category-card:nth-child(2) {
    animation-delay: 0.1s;
}

.category-card:nth-child(3) {
    animation-delay: 0.15s;
}

.category-card:nth-child(4) {
    animation-delay: 0.2s;
}

.category-card:nth-child(5) {
    animation-delay: 0.25s;
}

.category-card:nth-child(6) {
    animation-delay: 0.3s;
}

.category-card:nth-child(7) {
    animation-delay: 0.35s;
}

.category-card:nth-child(8) {
    animation-delay: 0.4s;
}

.category-card:nth-child(9) {
    animation-delay: 0.45s;
}

.category-card:nth-child(10) {
    animation-delay: 0.5s;
}

.category-card:nth-child(11) {
    animation-delay: 0.55s;
}

.category-card:nth-child(12) {
    animation-delay: 0.6s;
}

.category-card:nth-child(13) {
    animation-delay: 0.65s;
}

.category-card:nth-child(14) {
    animation-delay: 0.7s;
}

.category-card:nth-child(15) {
    animation-delay: 0.75s;
}

.category-card:nth-child(16) {
    animation-delay: 0.8s;
}

.category-card:nth-child(17) {
    animation-delay: 0.85s;
}

.category-card:nth-child(18) {
    animation-delay: 0.9s;
}

.category-card:nth-child(19) {
    animation-delay: 0.95s;
}

.category-card:nth-child(20) {
    animation-delay: 1s;
}

/* ==================== Loading Animation ==================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--color-accent);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== Toast Notification ==================== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition-normal);
    z-index: 3000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-left: 4px solid var(--color-accent);
}

.toast.error {
    border-left: 4px solid #ff6464;
}

/* ==================== Contact Button ==================== */
.contact-btn {
    background: var(--gradient-primary) !important;
    color: white !important;
    border-radius: var(--radius-md) !important;
    padding: 10px 18px !important;
    transition: var(--transition-normal) !important;
}

.contact-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.footer-contact-btn {
    display: inline-block;
    margin-top: 16px;
    padding: 12px 24px;
    background: var(--gradient-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition-normal);
}

.footer-contact-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

/* ==================== Contact Modal ==================== */
.contact-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.contact-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.contact-modal {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9) translateY(20px);
    transition: var(--transition-normal);
}

.contact-modal-overlay.active .contact-modal {
    transform: scale(1) translateY(0);
}

.contact-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--gradient-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.contact-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.contact-modal-close {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.contact-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.contact-modal-close svg {
    width: 18px;
    height: 18px;
    color: white;
}

.contact-form {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition-normal);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--bg-card-hover);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.contact-submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
}

.contact-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.contact-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.contact-status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    text-align: center;
    display: none;
}

.contact-status:not(:empty) {
    display: block;
}

.contact-status.success {
    background: rgba(0, 212, 170, 0.15);
    border: 1px solid rgba(0, 212, 170, 0.3);
    color: var(--color-accent);
}

.contact-status.error {
    background: rgba(255, 100, 100, 0.15);
    border: 1px solid rgba(255, 100, 100, 0.3);
    color: #ff6464;
}

/* Mobile Responsive for Contact Modal */
@media (max-width: 600px) {
    .contact-modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .contact-modal-header {
        border-radius: 0;
    }

    .contact-form {
        padding: 20px;
    }
}

/* ==================== Adsterra Ad Towers ==================== */
.adsterra-ad-tower {
    position: fixed;
    top: 100px;
    z-index: 999;
    width: 160px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.adsterra-ad-left {
    left: 10px;
}

.adsterra-ad-right {
    right: 10px;
}

.adsterra-ad-unit {
    width: 160px;
    height: 300px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: var(--bg-card);
}

/* ==================== Footer with Ads ==================== */
.footer-with-ads {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px 0;
}

.footer-ad {
    width: 160px;
    height: 300px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: var(--bg-card);
    flex-shrink: 0;
}

/* Hide ads on smaller screens */
@media (max-width: 1400px) {
    .adsterra-ad-tower {
        display: none;
    }

    .footer-ad {
        display: none;
    }

    .footer-with-ads {
        justify-content: center;
    }
}

/* ==================== Native Banner Ad Section ==================== */
.native-banner-section {
    padding: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-native-banners {
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
}