:root {
    --bg-color: #0d0d12;
    --card-bg: rgba(255, 255, 255, 0.05);
    --accent-color: #6366f1;
    --accent-hover: #4f46e5;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --glass-border: rgba(255, 255, 255, 0.1);
    --btn-bg: rgba(255, 255, 255, 0.08);
    --btn-hover: rgba(255, 255, 255, 0.15);
    --danger: #ef4444;
}

[data-theme="greenish"] {
    --bg-color: #061a12;
    --accent-color: #10b981;
    --accent-hover: #059669;
    --btn-bg: rgba(16, 185, 129, 0.1);
    --btn-hover: rgba(16, 185, 129, 0.2);
    --blob-1-color: #059669;
    --blob-2-color: #10b981;
    --blob-3-color: #34d399;
}

[data-theme="purple"] {
    --bg-color: #0f0a1e;
    --accent-color: #8b5cf6;
    --accent-hover: #7c3aed;
    --btn-bg: rgba(139, 92, 246, 0.1);
    --btn-hover: rgba(139, 92, 246, 0.2);
    --blob-1-color: #8b5cf6;
    --blob-2-color: #6d28d9;
    --blob-3-color: #a78bfa;
}

[data-theme="red"] {
    --bg-color: #1a0505;
    --accent-color: #ef4444;
    --accent-hover: #dc2626;
    --btn-bg: rgba(239, 68, 68, 0.1);
    --btn-hover: rgba(239, 68, 68, 0.2);
    --blob-1-color: #ef4444;
    --blob-2-color: #b91c1c;
    --blob-3-color: #fca5a5;
}

.top-controls {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 999;
}

.theme-selector {
    display: flex;
    gap: 12px;
    background: var(--card-bg);
    padding: 8px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}



@media (max-width: 480px) {
    .top-controls {
        top: 12px;
        right: 12px;
    }

    .theme-selector {
        padding: 6px;
        gap: 8px;
    }

    .theme-btn {
        width: 20px;
        height: 20px;
    }


}

/* Modal Styles */


.theme-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    background: #6366f1;
}

.theme-btn.greenish {
    background: #10b981;
}

.theme-btn.purple {
    background: #8b5cf6;
}

.theme-btn.red {
    background: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    filter: blur(80px);
}

.blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.5;
    animation: drift 20s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--blob-1-color, #6366f1);
    top: -10%;
    left: -10%;
}

.blob-2 {
    width: 350px;
    height: 350px;
    background: var(--blob-2-color, #ec4899);
    bottom: -5%;
    right: 5%;
    animation-delay: -5s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: var(--blob-3-color, #8b5cf6);
    top: 40%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes drift {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(100px, 50px) scale(1.1);
    }
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 420px;
    height: 700px;
    background: rgba(13, 13, 18, 0.95);
    /* Even more solid */
    backdrop-filter: blur(40px);
    /* Stronger blur */
    border: 2px solid rgba(255, 255, 255, 0.1);
    /* Thicker border */
    border-radius: 48px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05),
        0 25px 50px -12px rgba(0, 0, 0, 0.9);
    overflow: hidden;
    position: relative;
    z-index: 10;
}

@media (max-width: 480px) {
    .app-container {
        max-width: 100%;
        height: calc(100vh - 80px);
        margin-top: 60px;
        border-radius: 32px 32px 0 0;
        border: 1px solid var(--glass-border);
        border-bottom: none;
    }
}

header {
    padding: 24px 24px 12px;
}

.tabs {
    display: flex;
    background: var(--btn-bg);
    padding: 6px;
    border-radius: 16px;
    position: relative;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 12px;
    cursor: pointer;
    font-weight: 600;
    z-index: 1;
    transition: color 0.3s ease;
}

.tab-btn.active {
    color: white;
}

.tab-indicator {
    position: absolute;
    top: 6px;
    left: 6px;
    width: calc(50% - 8px);
    height: calc(100% - 12px);
    background: var(--accent-color);
    border-radius: 12px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

#tab-converter.active~.tab-indicator {
    transform: translateX(calc(100% + 4px));
}

/* Views */
main {
    flex: 1;
    position: relative;
    padding: 0 24px 24px;
}

.view {
    position: absolute;
    top: 0;
    left: 24px;
    right: 24px;
    bottom: 24px;
    display: none;
    flex-direction: column;
    animation: fadeIn 0.4s ease-out;
}

.view.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Calculator Styles */
.display-container {
    height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    margin-bottom: 24px;
}

.display-history {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    min-height: 1.2rem;
}

.display-main {
    font-size: 3rem;
    font-weight: 300;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    text-align: right;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.btn {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--btn-bg);
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn:hover {
    background: var(--btn-hover);
    transform: scale(1.05);
}

.btn:active {
    transform: scale(0.95);
}

.btn.accent {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-color);
    border-color: rgba(99, 102, 241, 0.3);
}

.btn.secondary {
    color: var(--text-secondary);
}

.btn.equal {
    background: var(--accent-color);
    grid-column: span 1;
}

.calc-rules {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
}

/* Converter Styles */
.converter-card {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-top: 10px;
}

.category-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 12px;
    scrollbar-width: none;
}

.category-bar::-webkit-scrollbar {
    display: none;
}

.cat-btn {
    padding: 8px 16px;
    background: var(--btn-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.cat-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.converter-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-trigger {
    width: 100%;
    background: var(--btn-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 14px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dropdown-trigger:hover {
    background: var(--btn-hover);
}

.chevron {
    width: 12px;
    height: 12px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: rotate(45deg);
    margin-bottom: 4px;
    transition: transform 0.3s ease;
}

.custom-dropdown.open .chevron {
    transform: rotate(-135deg) translate(-2px, -2px);
}

.dropdown-options {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: #1a1a24;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 100;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    max-height: 300px;
    overflow-y: auto;
}

[data-theme="greenish"] .dropdown-options {
    background: #0a241a;
}

[data-theme="purple"] .dropdown-options {
    background: #1a0a24;
}

[data-theme="red"] .dropdown-options {
    background: #240a0a;
}

.custom-dropdown.open .dropdown-options {
    display: flex;
    animation: slideDown 0.3s ease-out;
}

.custom-dropdown.open-up .dropdown-options {
    top: auto;
    bottom: calc(100% + 8px);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.option {
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 0.95rem;
}

.option:hover {
    background: var(--btn-bg);
    color: var(--accent-color);
}

.option.active {
    background: var(--accent-color);
    color: white;
}

label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input {
    background: var(--btn-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: white;
    padding: 14px;
    font-size: 1.5rem;
    font-weight: 600;
    outline: none;
    width: 100%;
    text-align: center;
}

.converter-row {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-top: 10px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.swap-icon {
    align-self: center;
    font-size: 1.8rem;
    color: var(--accent-color);
    cursor: pointer;
    background: var(--btn-bg);
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.swap-icon:hover {
    transform: rotate(180deg);
    background: var(--btn-hover);
}

.result-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 14px;
    font-size: 1.5rem;
    font-weight: 600;
    min-height: 52px;
    text-align: center;
}
