:root {
    --bg: linear-gradient(135deg, #ffd6e8, #e0c3fc);
    --calc-bg: #fff0f6;
    --btn-bg: #ffe4ec;
    --btn-hover: #ffc2d1;
    --text: #ff4d88;
    --special: #ffb3c6;
}

.dark {
    --bg: linear-gradient(135deg, #141e30, #243b55);
    --calc-bg: #1f2937;
    --btn-bg: #374151;
    --btn-hover: #4b5563;
    --text: #f9fafb;
    --special: #6366f1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

body {
    background: var(--bg);
    min-height: 100vh;
    transition: 0.3s;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 270px;
    background: var(--calc-bg);
    padding: 20px;
    box-shadow: 5px 0 15px rgba(0,0,0,0.1);
}

.sidebar h2 {
    color: var(--text);
    margin-bottom: 25px;
    text-align: center;
}

.menu-btn, #theme-toggle {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: none;
    border-radius: 10px;
    background: var(--btn-bg);
    color: var(--text);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-align: left;
    transition: 0.3s;
}

.menu-btn:hover, #theme-toggle:hover {
    background: var(--btn-hover);
    transform: translateX(5px);
}

/* Dropdown */
.dropdown-content {
    display: none;
    margin-left: 10px;
}

.dropdown-content button {
    width: 100%;
    padding: 10px;
    margin: 5px 0;
    border: none;
    border-radius: 8px;
    background: var(--btn-bg);
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.dropdown-content button:hover {
    background: var(--btn-hover);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Sections */
.section {
    display: none;
    width: 100%;
    max-width: 500px;
    background: var(--calc-bg);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    text-align: center;
}

.section.active {
    display: block;
}

h1, h2, h3 {
    color: var(--text);
    margin-bottom: 15px;
}

/* Display */
#display, #sci-display, #inputValue, select {
    width: 100%;
    height: 55px;
    border: none;
    border-radius: 12px;
    background: var(--btn-bg);
    font-size: 22px;
    text-align: right;
    padding: 10px;
    margin-bottom: 15px;
    outline: none;
    color: var(--text);
    font-weight: bold;
}

select {
    text-align: left;
    font-size: 18px;
}

/* Buttons Grid */
.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

button {
    height: 55px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    cursor: pointer;
    transition: 0.2s;
    background: var(--btn-bg);
    color: var(--text);
    font-weight: bold;
}

button:hover {
    transform: scale(1.05);
    background: var(--btn-hover);
}

button:active {
    transform: scale(0.95);
}

.buttons button:nth-child(4n) {
    background: var(--special);
    color: white;
}

.buttons button:last-child {
    background: #ff4d88;
    color: white;
}

/* History */
#history-list {
    list-style: none;
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
}

#history-list li {
    background: var(--btn-bg);
    margin: 8px 0;
    padding: 10px;
    border-radius: 10px;
    color: var(--text);
    font-weight: bold;
    word-wrap: break-word;
}

/* Converter Button */
#converter button {
    width: 100%;
    margin-top: 10px;
    background: var(--special);
    color: white;
}

/* Responsive */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .main-content {
        padding: 15px;
    }

    .section {
        max-width: 100%;
    }
}