html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column;
}

.app {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.tab-panels {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 48px); /* adjust if your header height differs */
}

.tab-panel {
    display: none;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0; /* important for children flex scrolling */
}

.tab-panel.active {
    display: flex;
}

#blocklyContainer {
    flex: 1 1 auto;
    min-height: 0;
}

#blocklyDiv {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.code-preview {
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.code-preview__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: #333;
}

.code-preview textarea { display: none; }
#copyCodeBtn { display: none; }

.sim-status {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 12px;
    background: #f7f7f7;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
}

.sim-status button {
    margin-left: auto;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background-color: #3F51B5;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
}

.sim-status button:hover {
    background-color: #32408f;
}

.message-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10001;
    pointer-events: none;
}

.message-box {
    min-width: 240px;
    max-width: 320px;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-left: 4px solid #2196F3;
    color: #1b1b1b;
    font-size: 14px;
    line-height: 1.5;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.message-box.visible {
    opacity: 1;
    transform: translateY(0);
}

.message-box--success { border-left-color: #4CAF50; }
.message-box--error { border-left-color: #F44336; }
.message-box--warning { border-left-color: #FF9800; }
.message-box--info { border-left-color: #2196F3; }

.message-box__text { flex: 1; }

.message-box__close {
    background: transparent;
    border: none;
    color: #555;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    margin-left: 4px;
}

.message-box__close:hover {
    color: #111;
}

h1, h2, h3 {
    color: #333;
    text-align: center;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.tab-header {
    display: flex;
    border-bottom: 1px solid #d0d0d0;
    background-color: #ffffff;
}

.tab-button {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #555;
}

.tab-button.active {
    border-bottom: 3px solid #4CAF50;
    color: #000;
    font-weight: bold;
}

.controls {
    padding: 16px;
    background-color: #fff;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.button-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.button-row button,
.sim-controls button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.button-row button:hover,
.sim-controls button:hover {
    background-color: #45a049;
}

#jsonCode {
    width: 100%;
    min-height: 100px;
    resize: vertical;
    box-sizing: border-box;
}

.hidden-textarea {
    display: none;
}

.sim-controls {
    padding: 16px;
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
}

#tab-simulator {
    background-color: #f9f9f9;
}

#tab-simulator iframe {
    flex: 1;
    width: 100%;
    border: none;
    min-height: 0;
}

@media (max-width: 600px) {
    .tab-button {
        font-size: 14px;
        padding: 10px;
    }

    .button-row {
        flex-direction: column;
        align-items: stretch;
    }
}
