@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=JetBrains+Mono:wght@500&display=swap');

:root {
    --primary: #00f0ff;
    --secondary: #ff0080;
    --dark: #0a0e1a;
    --surface: #151b2e;
    --surface-light: #1e2940;
    --text: #e8edf5;
    --text-dim: #8b95ab;
    --success: #00ff88;
    --error: #ff4466;
    --warning: #ffaa00;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

html, body {
    display: block;
    position: static;
    overflow-y: auto;
    height: auto;
    width: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--dark);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========================================= */
/* NAVIGATION */
/* ========================================= */

.main-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(21, 27, 46, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 240, 255, 0.15);
    width: 100%;
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-logo {
    font-size: 22px;
}

.nav-title {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-link:hover {
    color: var(--primary);
}

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text);
    font-size: 20px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
}

/* ========================================= */
/* HERO SECTION */
/* ========================================= */

.hero-section {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.08) 0%, rgba(255, 0, 128, 0.08) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 40px 20px;
    text-align: center;
}

.hero-section h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    line-height: 1.3;
}

.hero-subtitle {
    color: var(--text-dim);
    font-size: 16px;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ========================================= */
/* CONTAINER */
/* ========================================= */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================= */
/* TOOL SECTION (Calculator/Converter) */
/* ========================================= */

.tool-section {
    padding: 30px 0;
}

.tool-card {
    background: rgba(21, 27, 46, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    max-width: 500px;
    margin: 0 auto;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
}

.tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tab.active {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(255, 0, 128, 0.2));
    border-color: var(--primary);
    color: var(--text);
}

/* Views */
.view {
    display: none;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
}

.view.active {
    display: flex;
}

/* Display */
.display-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.display {
    background: var(--surface-light);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 24px;
    text-align: right;
    color: var(--primary);
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    overflow-x: auto;
    white-space: nowrap;
}

.display.secondary {
    font-size: 18px;
    color: var(--secondary);
    border-color: rgba(255, 0, 128, 0.3);
    min-height: 48px;
}

.display-label {
    font-size: 10px;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: -2px;
}

/* Calculator grid */
.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.calc-btn {
    background: var(--surface-light);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    user-select: none;
    touch-action: manipulation;
}

.calc-btn:active {
    transform: scale(0.95);
    background: var(--surface);
}

.calc-btn:hover {
    background: var(--surface);
    border-color: rgba(255, 255, 255, 0.2);
}

.calc-btn.operator {
    background: rgba(255, 0, 128, 0.15);
    border-color: rgba(255, 0, 128, 0.3);
    color: var(--secondary);
}

.calc-btn.function {
    background: rgba(0, 240, 255, 0.15);
    border-color: rgba(0, 240, 255, 0.3);
    color: var(--primary);
}

.calc-btn.clear {
    background: rgba(255, 68, 102, 0.2);
    color: var(--error);
}

.calc-btn.equals {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
    font-size: 22px;
}

/* Converter */
.converter-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.input-group {
    flex: 1;
}

.label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

select {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-light);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: all 0.3s;
}

.swap-btn {
    min-width: 44px;
    height: 44px;
    background: var(--surface-light);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--primary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.swap-btn:active {
    transform: rotate(180deg) scale(0.9);
}

.result-card {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.05), rgba(255, 0, 128, 0.05));
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 12px;
    padding: 14px;
}

.result-label {
    font-size: 10px;
    color: var(--text-dim);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.result-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 24px;
    font-weight: 600;
    color: var(--primary);
    word-break: break-all;
}

/* History */
.history {
    background: var(--surface);
    border-radius: 10px;
    padding: 12px;
    max-height: 180px;
    overflow-y: auto;
}

.history-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.history-item {
    padding: 8px 10px;
    background: var(--surface-light);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    background: rgba(0, 240, 255, 0.1);
}

/* Native Banner Ad */
.ad-native-banner {
    margin: 10px 0 20px;
    text-align: center;
    min-height: 50px;
}

/* ========================================= */
/* CONTENT SECTIONS */
/* ========================================= */

.content-section {
    padding: 40px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.content-section h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.content-section > p {
    color: var(--text-dim);
    font-size: 15px;
    margin-bottom: 24px;
    max-width: 800px;
    line-height: 1.7;
}

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

.content-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 24px;
    transition: border-color 0.3s;
}

.content-card:hover {
    border-color: rgba(0, 240, 255, 0.15);
}

.content-card h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
}

.content-card h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 16px 0 8px;
}

.content-card p {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 10px;
}

.content-card ol,
.content-card ul {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.8;
    padding-left: 20px;
    margin-bottom: 12px;
}

.content-card li {
    margin-bottom: 6px;
}

.content-card code {
    background: rgba(0, 240, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--primary);
}

/* Conversion Tables */
.conversion-table {
    overflow-x: auto;
    margin: 16px 0;
}

.conversion-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.conversion-table th {
    background: rgba(0, 240, 255, 0.1);
    color: var(--primary);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid rgba(0, 240, 255, 0.2);
}

.conversion-table td {
    padding: 10px 14px;
    color: var(--text-dim);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.conversion-table tr:hover td {
    background: rgba(0, 240, 255, 0.03);
}

/* Glossary Grid */
.glossary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.glossary-item {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 16px;
    transition: border-color 0.3s;
}

.glossary-item:hover {
    border-color: rgba(0, 240, 255, 0.15);
}

.glossary-item h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.glossary-item p {
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
}

/* ========================================= */
/* FAQ SECTION */
/* ========================================= */

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 800px;
}

.faq-item {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.3s;
}

.faq-item[open] {
    border-color: rgba(0, 240, 255, 0.2);
}

.faq-item summary {
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.3s;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    color: var(--primary);
    font-size: 20px;
    font-weight: 300;
    transition: transform 0.3s;
}

.faq-item[open] summary::after {
    content: '-';
}

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

.faq-item p {
    padding: 0 20px 16px;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.7;
}

/* ========================================= */
/* FOOTER */
/* ========================================= */

.site-footer {
    background: var(--surface);
    border-top: 1px solid rgba(0, 240, 255, 0.1);
    margin-top: 40px;
    padding: 40px 0 0;
}

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

.footer-col h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
}

.footer-col p {
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.7;
    margin-bottom: 8px;
}

.footer-col ul {
    list-style: none;
    padding: 0;
}

.footer-col ul li {
    margin-bottom: 8px;
}

.footer-col ul li a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.3s;
}

.footer-col ul li a:hover {
    color: var(--primary);
}

.footer-section {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 30px 0;
}

.footer-section h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
}

.footer-section p {
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.7;
    margin-bottom: 10px;
}

.footer-section ul {
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.7;
    padding-left: 20px;
    margin-bottom: 12px;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section a {
    color: var(--primary);
    text-decoration: none;
}

.footer-section a:hover {
    text-decoration: underline;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 20px 0;
    text-align: center;
}

.footer-bottom p {
    color: var(--text-dim);
    font-size: 12px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.3);
    border-radius: 3px;
}

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

/* ========================================= */
/* RESPONSIVE DESIGN */
/* ========================================= */

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(21, 27, 46, 0.98);
        flex-direction: column;
        padding: 16px 20px;
        gap: 12px;
        border-bottom: 1px solid rgba(0, 240, 255, 0.15);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }

    .hero-section {
        padding: 30px 16px;
    }

    .hero-section h1 {
        font-size: 22px;
    }

    .hero-subtitle {
        font-size: 14px;
    }

    .content-section h2 {
        font-size: 20px;
    }

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

    .calc-btn {
        min-height: 50px;
        font-size: 16px;
    }

    .display {
        font-size: 20px;
        min-height: 46px;
    }

    .display.secondary {
        font-size: 16px;
        min-height: 42px;
    }

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

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

@media (max-width: 480px) {
    .hero-section h1 {
        font-size: 19px;
    }

    .calc-btn {
        min-height: 46px;
        font-size: 15px;
    }

    .calc-btn.equals {
        font-size: 18px;
    }

    .display {
        font-size: 18px;
        min-height: 42px;
        padding: 10px 14px;
    }

    .display.secondary {
        font-size: 15px;
        min-height: 38px;
    }

    .content-card {
        padding: 18px;
    }

    .conversion-table {
        font-size: 12px;
    }
}
