/* ALL Create by LamberthRumpaidus */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #09090b;
    color: #fafafa;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#app {
    width: 95vw;
    height: 90vh;
    background: #18181b;
    border-radius: 16px;
    border: 1px solid #27272a;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

header {
    padding: 20px 30px;
    background: #09090b;
    border-bottom: 1px solid #27272a;
}

h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

h1 span {
    color: #3b82f6;
    margin-left: 5px;
}

main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#sidebar {
    width: 250px;
    background: #121214;
    border-right: 1px solid #27272a;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.cat-btn {
    padding: 20px;
    background: transparent;
    border: none;
    border-bottom: 1px solid #27272a;
    color: #a1a1aa;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cat-btn:hover {
    background: #18181b;
    color: #fafafa;
}

.cat-btn.active {
    background: #27272a;
    color: #3b82f6;
    border-left: 4px solid #3b82f6;
}

#workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 30px;
    overflow-y: auto;
    background: radial-gradient(circle at top right, #1f1f22, #18181b);
}

#topbar {
    margin-bottom: 30px;
}

#sub-selector {
    width: 100%;
    padding: 15px 20px;
    background: #09090b;
    border: 1px solid #3f3f46;
    border-radius: 8px;
    color: #fafafa;
    font-size: 1.1rem;
    font-weight: 600;
    outline: none;
    appearance: none;
    cursor: pointer;
}

#sub-selector:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

#dynamic-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    grid-column: 1 / -1;
}

.input-group label {
    font-size: 0.85rem;
    color: #a1a1aa;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input,
.input-group select {
    padding: 16px;
    background: #09090b;
    border: 1px solid #3f3f46;
    border-radius: 8px;
    color: #fafafa;
    font-family: 'Fira Code', monospace;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.input-group input:focus,
.input-group select:focus {
    border-color: #3b82f6;
    outline: none;
}

.keypad-toggle {
    align-self: flex-start;
    padding: 8px 16px;
    background: #27272a;
    color: #a1a1aa;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    margin-top: 5px;
}

.keypad-toggle:hover {
    background: #3f3f46;
    color: #fafafa;
}

.keypad-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 15px;
    background: #121214;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #27272a;
}

.keypad-btn {
    padding: 15px;
    font-size: 1.2rem;
    font-family: 'Fira Code', monospace;
    font-weight: 600;
    background: #18181b;
    color: #fafafa;
    border: 1px solid #27272a;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.1s;
}

.keypad-btn:hover {
    background: #27272a;
    border-color: #3b82f6;
}

.keypad-btn.action {
    background: #3b82f6;
    color: #fff;
    border-color: #2563eb;
}

.keypad-btn.action:hover {
    background: #2563eb;
}

.keypad-btn.clear {
    background: #ef4444;
    color: #fff;
    border-color: #dc2626;
}

.keypad-btn.clear:hover {
    background: #dc2626;
}

#action-panel {
    margin-top: auto;
}

#btn-calc {
    width: 100%;
    padding: 20px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s ease;
}

#btn-calc:hover {
    background: #2563eb;
}

#result-panel {
    margin-top: 20px;
    padding: 30px;
    background: #09090b;
    border: 1px solid #3f3f46;
    border-radius: 8px;
    border-left: 6px solid #10b981;
}

#output-val {
    font-family: 'Fira Code', monospace;
    font-size: 1.5rem;
    color: #10b981;
    word-break: break-all;
}

footer {
    text-align: center;
    padding: 15px;
    background: #09090b;
    border-top: 1px solid #27272a;
    font-size: 0.85rem;
    color: #71717a;
}

footer strong {
    color: #e4e4e7;
}

@media (max-width: 768px) {
    main {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: 150px;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid #27272a;
    }

    .cat-btn {
        white-space: nowrap;
        border-bottom: none;
        border-right: 1px solid #27272a;
    }

    .cat-btn.active {
        border-left: none;
        border-bottom: 4px solid #3b82f6;
    }
}