* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    min-height: 100vh;
    display: flex;
    padding: 24px;
    gap: 24px;
    color: #e0e0e0;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.sidebar {
    background: linear-gradient(145deg, #1e1e1e, #252525);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 28px;
    width: 400px;
    height: 100%;
    max-height: calc(100vh - 10px);
    overflow-y: auto;
    backdrop-filter: blur(10px);
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.nav-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.nav-tab {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.nav-tab.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.sidebar h2 {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.sidebar-instructions {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    margin-bottom: 20px;
    line-height: 1.4;
}

.search-bar {
    width: 100%;
    padding: 14px 18px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.search-bar:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.search-bar::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.category {
    margin-bottom: 12px;
}

.category-header {
    background: rgba(255, 255, 255, 0.06);
    padding: 14px 18px;
    border-radius: 14px;
    cursor: pointer;
    color: #e0e0e0;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.category-header:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.category-header.active {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.arrow-icon {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.arrow-icon.open {
    transform: rotate(90deg);
}

.items-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-top: 8px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.2);
}

.items-list.open {
    max-height: 500px;
}

.item {
    padding: 12px 18px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.item:first-child {
    border-radius: 14px 14px 0 0;
}

.item:last-child {
    border-bottom: none;
    border-radius: 0 0 14px 14px;
}

.item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    padding-left: 24px;
}

.item.selected-from {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.25), rgba(59, 130, 246, 0.1));
    border-left: 3px solid #3b82f6;
    color: #60a5fa;
    padding-left: 15px;
}

.item.selected-to {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.25), rgba(139, 92, 246, 0.1));
    border-left: 3px solid #8b5cf6;
    color: #a78bfa;
    padding-left: 15px;
}

.item.selected-from::after {
    content: "FROM";
    position: absolute;
    right: 12px;
    font-size: 0.65rem;
    background: #3b82f6;
    padding: 2px 6px;
    border-radius: 6px;
    color: white;
    font-weight: 600;
}

.item.selected-to::after {
    content: "TO";
    position: absolute;
    right: 12px;
    font-size: 0.65rem;
    background: #8b5cf6;
    padding: 2px 6px;
    border-radius: 6px;
    color: white;
    font-weight: 600;
}

.container {
    background: linear-gradient(145deg, #1e1e1e, #252525);
    border-radius: 28px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 40px;
    flex: 1;
    max-width: 600px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

h1 {
    color: #ffffff;
    text-align: center;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: -1px;
}

.subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    margin-bottom: 40px;
}

.converter-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 32px;
}

.block-container {
    background: rgba(255, 255, 255, 0.04);
    padding: 24px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
}

.block-container:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
}

.block-container.active-from {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.block-container.active-to {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.block-container.has-selection {
    cursor: pointer;
}

label {
    display: block;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.block-container.active-from label {
    color: #3b82f6;
}

.block-container.active-to label {
    color: #8b5cf6;
}

.block-display {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-weight: 500;
}

.block-display-placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.9rem;
}

.selection-hint {
    margin-top: 12px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    min-height: 18px;
}

.block-container.active-from .selection-hint {
    color: #60a5fa;
    animation: pulse 2s ease-in-out infinite;
}

.block-container.active-to .selection-hint {
    color: #a78bfa;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.arrow {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
    transform: rotate(90deg);
}

.amount-section {
    background: rgba(255, 255, 255, 0.04);
    padding: 24px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 24px;
}

input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

button {
    width: 100%;
    padding: 18px;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

button:hover:not(:disabled) {
    background: linear-gradient(135deg, #454545 0%, #353535 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.result {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 28px;
    margin-top: 24px;
    display: none;
    text-align: center;
}

.result.show {
    display: block;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-text {
    color: #ffffff;
    font-size: 1.1rem;
    line-height: 1.8;
    font-weight: 500;
}

.reset-button {
    margin-top: 16px;
    padding: 10px 20px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-button:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* Improved Adblock popup styles */
.adblock-popup {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 260ms ease;
    z-index: 1100;
}

.adblock-popup.show,
.adblock-popup[aria-hidden="false"] {
    opacity: 1;
    pointer-events: auto;
}

.adblock-popup-inner {
    background: rgba(30, 30, 30, 0.85);
    border-radius: 20px;
    padding: 36px;
    max-width: 420px;
    width: calc(100% - 64px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 14px 55px rgba(0, 0, 0, 0.7);
    text-align: center;
    backdrop-filter: blur(12px);

    transform: translateY(20px) scale(0.96);
    opacity: 0;
}

.adblock-popup.show .adblock-popup-inner,
.adblock-popup[aria-hidden="false"] .adblock-popup-inner {
    animation: popup-in 320ms ease forwards;
}

@keyframes popup-in {
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.adblock-popup h3 {
    margin: 0 0 12px;
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffd657;
    letter-spacing: 0.4px;
}

.adblock-popup p {
    margin: 0;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.86);
    line-height: 1.55;
}

.adblock-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,0.08);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 160ms ease, transform 140ms ease;
}

.adblock-close::before {
    content: "";
    width: 16px;
    height: 16px;
    display: block;
    background-size: contain;
    background-repeat: no-repeat;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" stroke="white" stroke-width="2" stroke-linecap="round" viewBox="0 0 24 24"><line x1="6" y1="6" x2="18" y2="18"/><line x1="6" y1="18" x2="18" y2="6"/></svg>');
}

.adblock-close:hover {
    background: rgba(255,255,255,0.18);
    transform: scale(1.08);
}

.ad-container {
    margin-top: 32px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 100px;
}

.ad-container ins.adsbygoogle {
    display: block !important;
}

@media (max-width: 1024px) {
    body {
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .sidebar {
        width: 100%;
        max-width: 320px;
        max-height: 400px;
        overflow-y: auto;
    }
    
    h1 {
        font-size: 1.5rem;
    }
}