/* style.css - KBMB.net - Dark Blue + White + Orange CTA Color Combination */

:root {
    --primary: #1e3a8a; /* Dark Blue */
    --primary-dark: #1e3a8a;
    --accent: #f97316; /* Orange CTA */
    --accent-hover: #ea580c;
    --accent-light: #ffedd5;
    --bg: #f8fafc;
    --text: #0f172a;
    --card: #ffffff;
    --gray: #64748b;
    --gray-light: #e2e8f0;
    --gray-dark: #334155;
    --border: #e2e8f0;
    --menu-bg: #ffffff;
    --menu-text: #0f172a;
    --menu-hover: #f1f5f9;
    --header-bg: #ffffff;
    --header-text: #0f172a;
    --header-muted: #64748b;
    --footer-bg: #0f172a;
    --footer-text: #f1f5f9;
    --footer-muted: #94a3b8;
    --footer-border: #334155;
    --breadcrumb-bg: #f1f5f9;
    --success-bg: #e6f7e6;
    --success-text: #0a5e0a;
    --warning-bg: #fff3cd;
    --warning-text: #856404;
    --error-bg: #f8d7da;
    --error-text: #721c24;
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --accent: #f97316;
    --accent-hover: #ea580c;
    --accent-light: #7c3a1e;
    --bg: #0f172a;
    --text: #f1f5f9;
    --card: #1e293b;
    --gray: #94a3b8;
    --gray-light: #334155;
    --gray-dark: #475569;
    --border: #334155;
    --menu-bg: #1e293b;
    --menu-text: #f1f5f9;
    --menu-hover: #334155;
    --header-bg: #1e293b;
    --header-text: #f1f5f9;
    --header-muted: #94a3b8;
    --footer-bg: #0a0f1a;
    --footer-text: #e2e8f0;
    --footer-muted: #94a3b8;
    --footer-border: #2d3a4f;
    --breadcrumb-bg: #1e293b;
    --success-bg: #0a3a0a;
    --success-text: #a3e0a3;
    --warning-bg: #4a3a0a;
    --warning-text: #ffd966;
    --error-bg: #4a1a1a;
    --error-text: #f8a5a5;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header Styles */
header {
    background: var(--header-bg);
    color: var(--header-text);
    position: relative;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid var(--border);
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
}

.logo img {
    height: 2.6rem;
    width: auto;
    display: block;
}

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

.dropdown summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gray-light);
    color: var(--header-text);
    padding: 0.65rem 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    user-select: none;
    list-style: none;
    border: 1px solid var(--border);
    transition: background 0.2s;
}

.dropdown summary:hover {
    background: var(--border);
}

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

.dropdown summary::after {
    content: "▼";
    font-size: 0.7rem;
    margin-left: 0.3rem;
    opacity: 0.8;
    transition: transform 0.2s;
    color: var(--header-text);
}

.dropdown[open] summary::after {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: fixed;
    top: 70px;
    left: 1rem;
    width: 280px;
    max-width: 85vw;
    background: var(--menu-bg);
    color: var(--menu-text);
    padding: 0.75rem 0;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.2s ease;
    max-height: 80vh;
    overflow-y: auto;
}

.dropdown[open] .dropdown-menu {
    display: flex;
    opacity: 1;
}

.menu-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--menu-text);
    background: transparent;
    border: none;
    padding: 0.25rem 0.5rem;
    display: block;
    z-index: 2001;
    border-radius: 4px;
}

.menu-close:hover {
    background: var(--menu-hover);
}

.dropdown-menu a {
    padding: 0.85rem 1.4rem;
    font-size: 1rem;
    color: var(--menu-text);
    text-decoration: none;
    transition: background 0.2s;
    display: block;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

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

.dropdown-menu a:hover,
.dropdown-menu a.active {
    background: var(--menu-hover);
    color: var(--primary);
}

.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 1999;
}

.dropdown[open] + .menu-overlay {
    display: block;
}

/* Theme Switch */
.theme-switch {
    background: var(--gray-light);
    border: 1px solid var(--border);
    color: var(--header-text);
    padding: 0.65rem 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1rem;
    transition: background 0.2s;
}

.theme-switch:hover {
    background: var(--border);
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
    opacity: 0.5;
}

/* Breadcrumb Navigation */
.breadcrumb {
    padding: 1rem 0;
    background: transparent;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--gray);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb span {
    color: var(--gray);
}

.breadcrumb .separator {
    color: var(--gray);
    font-size: 0.8rem;
}

.breadcrumb .current {
    color: var(--primary);
    font-weight: 500;
}

/* Headings */
h1 {
    font-size: clamp(1.8rem, 5vw, 2.4rem);
    margin: 1.5rem 0 0.8rem;
    text-align: center;
    color: var(--primary);
}

h2 {
    color: var(--primary);
    margin: 2rem 0 1rem;
    font-size: 1.8rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

h3 {
    margin: 1.5rem 0 1rem;
    font-size: 1.3rem;
    color: var(--primary);
}

.intro-text {
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto 2rem;
    text-align: center;
    color: var(--gray);
}

/* Converter Sections Grid */
.converters-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.converter-group {
    background: var(--card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.converter-group:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.group-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.group-title i {
    font-size: 1.5rem;
}

.converters-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}

.converter-link {
    background: var(--gray-light);
    color: var(--text);
    text-decoration: none;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
    border: 1px solid transparent;
    text-align: center;
}

.converter-link:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-2px);
}

.unit-info {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--gray);
    border: 1px solid var(--border);
}

.unit-info code {
    background: var(--card);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    color: var(--primary);
    font-family: monospace;
}

/* Popular Converters Grid */
.popular-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.popular-link {
    background: var(--card);
    color: var(--text);
    text-decoration: none;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    text-align: center;
    transition: all 0.2s;
    font-weight: 500;
}

.popular-link:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* Info Sections */
.info-section {
    background: var(--card);
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    border: 1px solid var(--border);
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

th, td {
    border: 1px solid var(--border);
    padding: 0.9rem;
    text-align: center;
}

th {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

tr:hover {
    background: var(--gray-light);
}

/* List Styles */
ul, ol {
    margin: 1rem 0 1rem 2rem;
}

li {
    margin: 0.5rem 0;
}

/* Ad Container */
.adsense-container {
    margin: 2rem auto;
    text-align: center;
    min-height: 90px;
    background: var(--card);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--border);
}

.adsense-label {
    font-size: 0.75rem;
    color: var(--gray);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ad-placeholder {
    background: linear-gradient(135deg, var(--gray-light) 0%, var(--border) 100%);
    color: var(--gray);
    padding: 1rem;
    border-radius: 4px;
    font-weight: 500;
}

/* Footer Styles */
footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    text-align: center;
    padding: 2.5rem 1rem;
    margin-top: 4rem;
    font-size: 0.95rem;
    border-top: 1px solid var(--footer-border);
}

footer a {
    color: var(--footer-muted);
    text-decoration: none;
    transition: color 0.2s;
    margin: 0 0.5rem;
}

footer a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.footer-copyright {
    color: var(--footer-muted);
    font-size: 0.85rem;
    margin-top: 1rem;
}

/* Desktop Styles */
@media (min-width: 768px) {
    .dropdown-menu {
        position: absolute;
        top: calc(100% + 0.5rem);
        left: 0;
        width: 280px;
        max-width: 280px;
    }
    .menu-close {
        display: none;
    }
}

/* Mobile Styles */
@media (max-width: 600px) {
    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    .converters-list {
        grid-template-columns: 1fr;
    }
    h1 {
        font-size: 1.8rem;
    }
    h2 {
        font-size: 1.5rem;
    }
    .info-section {
        padding: 1.5rem;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.hidden {
    display: none !important;
}

/* Alert/Message Styles */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-text);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-color: var(--warning-text);
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-text);
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 1rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.btn-accent {
    background: var(--accent);
    color: white;
}

.btn-accent:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Form Elements */
input, select, textarea {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

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

label {
    font-weight: 500;
    color: var(--gray);
    margin-bottom: 0.25rem;
    display: block;
}

/* Card Styles */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Tool Container for Converters */
.tool-container {
    background: var(--card);
    border-radius: 24px;
    padding: 2rem;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    margin: 1.5rem 0;
}

.tool-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

/* Main Content Layout - Desktop: tool left, ad right */
.main-content {
    display: flex;
    gap: 2rem;
    margin: 1.5rem 0 2rem;
}

.tool-section {
    flex: 1;
    min-width: 0;
}

.ad-section-desktop {
    width: 300px;
    flex-shrink: 0;
}

/* Fixed Vertical Ad (250*300) */
.vertical-ad {
    width: 250px;
    height: 300px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 100px;
    margin: 0 auto;
}

.ad-placeholder-vertical {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--gray-light) 0%, var(--border) 100%);
    color: var(--gray);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Mobile Ad */
.ad-section-mobile {
    display: none;
    margin: 1.5rem 0;
    width: 100%;
}

.mobile-ad {
    width: 100%;
    min-height: 100px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

/* Responsive */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }
    .ad-section-desktop {
        display: none;
    }
    .ad-section-mobile {
        display: block;
    }
    .vertical-ad {
        position: static;
        width: 100%;
        height: auto;
        margin: 0;
    }
    .ad-placeholder-vertical {
        height: 100px;
    }
}

/* Converter Input Styles */
.converter-box {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    width: 100%;
}

.input-label {
    font-size: 1rem;
    color: var(--gray);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.input-button-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
}

.input-wrapper input {
    width: 100%;
    padding: 0.75rem 0;
    font-size: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text);
    outline: none;
}

.input-wrapper input[type="number"] {
    -moz-appearance: textfield;
}

.input-wrapper input[type="number"]::-webkit-outer-spin-button,
.input-wrapper input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.unit-badge {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
    padding: 0.25rem 0.5rem;
    background: var(--gray-light);
    border-radius: 6px;
}

.convert-button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
    min-width: 120px;
}

.convert-button:hover {
    background: var(--accent-hover);
}

.convert-button:active {
    transform: scale(0.98);
}

/* Results in adjacent format */
.results-adjacent {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
    padding: 1.5rem;
    background: var(--bg);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.result-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 1.2rem;
    line-height: 1.6;
    flex-wrap: wrap;
}

.result-number {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.3rem;
}

.result-text {
    color: var(--text);
}

.result-unit {
    color: var(--gray);
    font-weight: 500;
}

.result-bold {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.3rem;
}

/* Quick Conversions Table */
.quick-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
}

.quick-table th {
    background: var(--primary);
    color: white;
    padding: 1rem;
    text-align: center;
}

.quick-table td {
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border);
}

.quick-table tr:hover {
    background: var(--gray-light);
}

/* Related Converters */
.related-converters {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.related-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.related-link {
    background: var(--gray-light);
    color: var(--text);
    text-decoration: none;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
    text-align: center;
    border: 1px solid transparent;
}

.related-link:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
}

/* Article Section */
.article-section {
    background: var(--card);
    border-radius: 24px;
    padding: 2rem;
    margin: 2rem 0;
    border: 1px solid var(--border);
}

.article-section h2 {
    color: var(--primary);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.article-section h3 {
    color: var(--primary);
    font-size: 1.3rem;
    margin: 1.5rem 0 1rem;
}

.article-section p {
    margin-bottom: 1rem;
    color: var(--text);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .input-button-row {
        flex-wrap: nowrap;
    }
    .convert-button {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        min-width: 100px;
    }
    .result-row {
        font-size: 1rem;
    }
    .result-number,
    .result-bold {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .input-button-row {
        gap: 0.5rem;
    }
    .input-wrapper {
        padding: 0.25rem 0.75rem;
    }
    .input-wrapper input {
        font-size: 1.2rem;
        padding: 0.5rem 0;
    }
    .unit-badge {
        font-size: 1rem;
    }
    .convert-button {
        padding: 0.6rem 0.8rem;
        font-size: 0.95rem;
        min-width: 85px;
    }
}