/* =============== ROOT VARIABLES =============== */
:root {
    --primary-color: #1877f2;
    --primary-dark: #155db1;
    --primary-light: #3b8ef7;
    
    --bg-color: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: #ffffff;
    
    --text-color: #2c3e50;
    --text-secondary: #6c757d;
    --text-light: #95a5a6;
    
    --border-color: #e9ecef;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 5px 20px rgba(0, 0, 0, 0.15);
    
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    
    --font-primary: 'Inter', sans-serif;
    --transition: all 0.3s ease;
    
    --header-height: 70px;
}

/* Dark Mode Variables */
body.dark-mode {
    --bg-color: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    
    --text-color: #e9ecef;
    --text-secondary: #adb5bd;
    --text-light: #868e96;
    
    --border-color: #2d3748;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 5px 20px rgba(0, 0, 0, 0.4);
}

/* =============== RESET & BASE =============== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
}

/* =============== UTILITIES =============== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section__title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.section__subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

/* =============== HEADER & NAVIGATION =============== */
.header {
    position: sticky;
    top: 0;
    width: 100%;
    background: var(--bg-card);
    box-shadow: var(--shadow);
    z-index: 1000;
    transition: var(--transition);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
}

.nav__logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.nav__logo:hover {
    transform: scale(1.05);
}

.nav__list {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    align-items: center;
}

.nav__link {
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.nav__link:hover,
.nav__link.active {
    background: var(--primary-color);
    color: #ffffff;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown > .nav__link {
    cursor: pointer;
}

.dropdown > .nav__link .fa-chevron-down {
    font-size: 0.75rem;
    transition: var(--transition);
    margin-left: 0.25rem;
}

.dropdown.active > .nav__link .fa-chevron-down {
    transform: rotate(180deg);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    min-width: 220px;
    box-shadow: var(--shadow-hover);
    border-radius: 8px;
    margin-top: 0.5rem;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
    z-index: 1000;
}

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

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown.active .dropdown-content {
    display: block;
}

.dropdown-content a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background: var(--primary-light);
    color: #ffffff;
    padding-left: 1.5rem;
}

/* Navigation Actions */
.nav__actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav__search-btn,
.theme-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
}

.nav__search-btn:hover,
.theme-toggle:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.nav__toggle,
.nav__close {
    display: none;
}

/* Search Bar */
.search-bar {
    display: none;
    background: var(--bg-secondary);
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
    animation: slideDown 0.3s ease;
}

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

.search-bar.active {
    display: block;
}

.search-input-wrapper {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-input-wrapper i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-input-wrapper input {
    width: 100%;
    padding: 1rem 3rem 1rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    font-size: 1rem;
    font-family: var(--font-primary);
    background: var(--bg-card);
    color: var(--text-color);
    transition: var(--transition);
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-close {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.search-close:hover {
    color: var(--danger);
}

.search-results {
    max-width: 600px;
    margin: 1rem auto 0;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

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

.search-result-item a {
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-result-item i {
    color: var(--primary-color);
    font-size: 1.5rem;
}

/* =============== AD PLACEHOLDERS =============== */
.ad-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    margin: 1rem 0;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
    opacity: 0.7;
}

.ad-header {
    margin: 1rem auto;
    max-width: 1200px;
}

.ad-content {
    max-width: 1200px;
    margin: 2rem auto;
}

.ad-sidebar {
    margin: 2rem 0;
}

/* =============== HERO SECTION =============== */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 5rem 0;
    text-align: center;
}

.hero__title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.8s ease;
}

.hero__description {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto 2rem;
    opacity: 0.95;
    animation: fadeInUp 1s ease;
}

.hero__cta {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: white;
    color: var(--primary-color);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    animation: fadeInUp 1.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.hero__cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

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

/* =============== FEATURED CALCULATORS =============== */
.featured {
    padding: 4rem 0;
}

.tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tab-btn {
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: block;
}

/* Calculator Card */
.calculator-card {
    max-width: 400px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-hover);
}

.calculator-card.scientific {
    max-width: 500px;
}

.calculator-display {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: right;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    word-wrap: break-word;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.calculator-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.scientific-buttons {
    grid-template-columns: repeat(5, 1fr);
}

.calc-btn {
    padding: 1.25rem;
    font-size: 1.25rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-secondary);
    color: var(--text-color);
}

.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

.calc-btn.operator {
    background: var(--primary-color);
    color: white;
}

.calc-btn.operator:hover {
    background: var(--primary-dark);
}

.calc-btn.equals {
    background: var(--success);
    color: white;
}

.calc-btn.equals:hover {
    background: #218838;
}

.calc-btn.secondary {
    background: var(--text-secondary);
    color: white;
}

.calc-btn.secondary:hover {
    background: var(--text-color);
}

/* =============== CATEGORIES SECTION =============== */
.categories {
    padding: 4rem 0;
    background: var(--bg-secondary);
}

.category-section {
    margin-bottom: 4rem;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.category-icon {
    font-size: 2rem;
    color: var(--primary-color);
}

.category-header h3 {
    font-size: 2rem;
    font-weight: 700;
}

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

.calculator-item {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.calculator-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.calculator-item i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: block;
}

.calculator-item h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.calculator-item p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* =============== FAQ SECTION =============== */
.faq {
    padding: 4rem 0;
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.faq-question {
    width: 100%;
    padding: 1.5rem;
    background: none;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: left;
    transition: var(--transition);
}

.faq-question:hover {
    color: var(--primary-color);
}

.faq-question i {
    transition: var(--transition);
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

.faq-answer p {
    padding: 0 1.5rem 1.5rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* =============== FOOTER =============== */
.footer {
    background: var(--bg-card);
    padding: 4rem 0 2rem;
    border-top: 1px solid var(--border-color);
}

.footer__content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer__logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.footer__description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.footer__social {
    display: flex;
    gap: 1rem;
}

.footer__social a {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 50%;
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
}

.footer__social a:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-3px);
}

.footer__column h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.footer__links {
    list-style: none;
}

.footer__links li {
    margin-bottom: 0.75rem;
}

.footer__links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    display: inline-block;
}

.footer__links a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

.footer__bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* =============== CALCULATOR PAGE STYLES =============== */
.calc-page {
    padding: 2rem 0;
    min-height: calc(100vh - var(--header-height));
}

.calc-header {
    text-align: center;
    margin-bottom: 3rem;
}

.calc-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.calc-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
}

.calc-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    margin-bottom: 3rem;
}

.calc-main {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.calc-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-primary);
    background: var(--bg-color);
    color: var(--text-color);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.result-box {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-top: 2rem;
    display: none;
}

.result-box.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

.result-box h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.info-section {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.info-section h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.info-section h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.info-section p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.info-section ul,
.info-section ol {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-left: 2rem;
    margin-bottom: 1rem;
}

/* =============== RESPONSIVE DESIGN =============== */
@media screen and (max-width: 968px) {
    .nav__menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 400px;
        height: 100vh;
        background: var(--bg-card);
        padding: 6rem 2rem 2rem;
        box-shadow: var(--shadow-hover);
        transition: var(--transition);
    }

    .nav__menu.show-menu {
        right: 0;
    }

    .nav__list {
        flex-direction: column;
        width: 100%;
    }

    .nav__link {
        width: 100%;
    }

    .dropdown-content {
        position: static;
        display: none;
        box-shadow: none;
        background: var(--bg-secondary);
        margin-top: 0.5rem;
    }

    .dropdown.active .dropdown-content {
        display: block;
    }

    .nav__toggle,
    .nav__close {
        display: block;
        font-size: 1.5rem;
        cursor: pointer;
    }

    .nav__close {
        position: absolute;
        top: 1rem;
        right: 1rem;
    }

    .hero__title {
        font-size: 2rem;
    }

    .hero__description {
        font-size: 1rem;
    }

    .section__title {
        font-size: 2rem;
    }

    .tabs {
        flex-direction: column;
    }

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

    .calc-content {
        grid-template-columns: 1fr;
    }

    .calc-sidebar {
        order: -1;
    }
}

@media screen and (max-width: 576px) {
    .hero {
        padding: 3rem 0;
    }

    .hero__title {
        font-size: 1.75rem;
    }

    .calculator-buttons {
        gap: 0.5rem;
    }

    .calc-btn {
        padding: 1rem;
        font-size: 1.1rem;
    }

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

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

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

/* =============== PRINT STYLES =============== */
@media print {
    .header,
    .hero,
    .ad-placeholder,
    .footer {
        display: none;
    }
}