/* Reset & General Styles */
body {
    margin: 0;
    padding: 20px;
    font-family: Arial, Helvetica, sans-serif;
    background-color: #ffffff;
    color: #000000;
    line-height: 1.5;
}

/* Page Container */
#container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    gap: 30px;
}

/* Sidebar Navigation */
#sidebar {
    width: 180px;
    flex-shrink: 0;
}

.nav-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    margin-bottom: 5px;
    background-color: #3ca0e8;
    color: #ffffff;
    border: none;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    border-radius: 2px;
}

.nav-btn:hover {
    background-color: #2b9dec;
}

.nav-btn.active {
    background-color: #aed6f1;
    color: #1b4f72;
}

/* Badge for "NEW" */
.badge-new {
    background-color: #2ecc71;
    color: white;
    font-size: 9px;
    padding: 1px 3px;
    border-radius: 3px;
    float: right;
    margin-top: 3px;
    font-weight: bold;
}

/* Sidebar Ad & Links Placeholder */
.sidebar-box {
    margin-top: 15px;
    border: 1px solid #e0e0e0;
    background-color: #f9f9f9;
    padding: 10px;
    font-size: 11px;
    box-sizing: border-box;
}

.sidebar-box h4 {
    margin: 0 0 5px 0;
    font-size: 11px;
    color: #666;
}

.sidebar-box a {
    color: #0066cc;
    text-decoration: none;
}

.sidebar-box a:hover {
    text-decoration: underline;
}

.piano-placeholder {
    width: 100%;
    margin-top: 8px;
    border: 1px solid #ccc;
}

/* Main Content Area */
#main-content {
    flex-grow: 1;
    min-width: 0; /* Prevents flex items from overflowing */
}

/* Headers */
h1 {
    font-family: 'Courier New', Courier, monospace;
    font-size: 32px;
    font-weight: bold;
    margin: 0 0 5px 0;
    text-transform: none;
    letter-spacing: -0.5px;
}

h2 {
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 25px 0;
    color: #000000;
}

hr {
    border: 0;
    border-top: 2px solid #000000;
    margin-bottom: 20px;
}

p {
    font-size: 14px;
    margin-bottom: 20px;
    text-align: justify;
}

/* Warning alert standard style */
.warning-box {
    border: 1px solid #f39c12;
    background-color: #fef9e7;
    color: #7f8c8d;
    padding: 12px;
    font-size: 13px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.warning-box strong {
    color: #d35400;
}

/* Central Controls Box */
.control-box {
    background-color: #f2f2f2;
    border: 1px solid #dcdcdc;
    padding: 30px;
    margin: 30px auto;
    max-width: 500px;
    text-align: center;
    border-radius: 3px;
}

/* Frequencies Display Container */
.frequencies-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
}

.frequency-field {
    display: inline-block;
    text-align: center;
}

.large-input {
    width: 130px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 36px;
    font-weight: bold;
    text-align: center;
    padding: 5px;
    border: 1px solid #cccccc;
    background-color: #ffffff;
    box-sizing: border-box;
}

.label-input {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #333333;
    font-weight: bold;
}

/* Audio Controls (Play/Stop) */
.play-stop-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

.btn-play {
    background-color: #4eb552;
    color: #ffffff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 28px;
    font-weight: bold;
    padding: 6px 20px;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

.btn-play:hover {
    background-color: #419b45;
}

.btn-stop {
    background-color: #d8453c;
    color: #ffffff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 28px;
    font-weight: bold;
    padding: 6px 20px;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

.btn-stop:hover {
    background-color: #c0392b;
}

.btn-action {
    background-color: #3ca0e8;
    color: white;
    border: none;
    padding: 8px 15px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
}

.btn-action:hover {
    background-color: #2b9dec;
}

/* Hidden Utility */
.hidden {
    display: none !important;
}

/* Tool specific Form Elements */
.form-row {
    margin-bottom: 15px;
    text-align: left;
}

.form-row label {
    display: inline-block;
    width: 140px;
    font-weight: bold;
    font-size: 13px;
}

.form-row select, .form-row input[type="text"], .form-row input[type="number"] {
    padding: 5px;
    font-size: 13px;
    border: 1px solid #ccc;
    width: 180px;
}

.form-row input[type="range"] {
    vertical-align: middle;
    width: 180px;
}

.form-row span.val-display {
    display: inline-block;
    margin-left: 8px;
    font-family: monospace;
    font-size: 13px;
}

/* Multiple Tone Generator Rows */
.osc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    padding: 10px;
    border: 1px solid #ddd;
    margin-bottom: 10px;
    border-radius: 3px;
}

.osc-row select, .osc-row input[type="number"] {
    padding: 4px;
    border: 1px solid #ccc;
}

.osc-row input[type="range"] {
    flex-grow: 1;
    max-width: 150px;
}

.btn-delete {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    border-radius: 2px;
}

.btn-delete:hover {
    background: #c0392b;
}

/* Canvas layouts */
.canvas-container {
    margin-top: 15px;
    background-color: #000;
    border: 1px solid #333;
    border-radius: 3px;
    overflow: hidden;
}

.tuner-canvas {
    width: 100%;
    height: 120px;
    display: block;
}

.audiogram-canvas {
    background-color: #fff;
    border: 1px solid #ccc;
    display: block;
    margin: 20px auto 0 auto;
}

/* DTMF Keypad Grid */
.dtmf-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 250px;
    margin: 15px auto;
}

.dtmf-btn {
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    font-family: monospace;
    font-size: 20px;
    font-weight: bold;
    padding: 12px;
    cursor: pointer;
    border-radius: 3px;
}

.dtmf-btn:active {
    background-color: #ddd;
}

/* Mini Keyboard Style for 432Hz */
.keyboard {
    display: flex;
    justify-content: center;
    position: relative;
    height: 120px;
    margin: 20px auto;
    width: 100%;
    max-width: 420px;
    background-color: #000;
    border: 2px solid #000;
}

.key-white {
    width: 40px;
    height: 100%;
    background-color: #fff;
    border-right: 1px solid #ccc;
    box-sizing: border-box;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.key-white:active {
    background-color: #ddd;
}

.key-black {
    width: 24px;
    height: 60%;
    background-color: #000;
    cursor: pointer;
    margin-left: -12px;
    margin-right: -12px;
    z-index: 2;
    position: relative;
}

.key-black:active {
    background-color: #333;
}

/* Shop and About Styles */
.info-section {
    margin-bottom: 25px;
}

.info-section h3 {
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    font-family: 'Courier New', Courier, monospace;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.shop-item {
    border: 1px solid #e0e0e0;
    padding: 15px;
    background-color: #fdfdfd;
    text-align: center;
}

.shop-item img {
    max-width: 100px;
    height: auto;
    display: block;
    margin: 0 auto 10px auto;
    border: 1px solid #eee;
}

.shop-item h4 {
    margin: 5px 0;
}

.shop-price {
    font-weight: bold;
    color: #e74c3c;
    margin-bottom: 10px;
}

/* Recording list elements */
.rec-list {
    margin-top: 15px;
    text-align: left;
}

.rec-item {
    background: white;
    padding: 8px;
    border: 1px solid #eee;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Metronome beat dots */
.beat-indicator {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
}

.beat-dot {
    width: 15px;
    height: 15px;
    background-color: #ddd;
    border-radius: 50%;
}

.beat-dot.active {
    background-color: #2ecc71;
}

.beat-dot.accent {
    background-color: #e74c3c;
}

/* Preset Manager Styles */
.preset-manager-box {
    background-color: #fafafa;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 25px;
    text-align: left;
}

.preset-manager-box h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    font-family: Arial, Helvetica, sans-serif;
    border-bottom: 1px dashed #ddd;
    padding-bottom: 5px;
}

.preset-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.preset-row label {
    font-size: 13px;
    font-weight: bold;
    width: 70px;
    flex-shrink: 0;
}

.preset-row select, .preset-row input[type="text"] {
    flex-grow: 1;
    padding: 6px;
    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background-color: #fff;
    min-width: 0;
    box-sizing: border-box;
}

.preset-row .btn-action, .preset-row .btn-delete {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.preset-actions-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 15px;
}

.preset-actions-row .btn-action {
    padding: 5px 10px;
    font-size: 11px;
    font-weight: bold;
}

.btn-save {
    background-color: #2ecc71 !important;
}

.btn-save:hover {
    background-color: #27ae60 !important;
}

.btn-export, .btn-import {
    background-color: #7f8c8d !important;
}

.btn-export:hover, .btn-import:hover {
    background-color: #95a5a6 !important;
}

.btn-reset {
    background-color: #e67e22 !important;
}

.btn-reset:hover {
    background-color: #d35400 !important;
}

/* Responsive sidebar */
@media (max-width: 768px) {
    #container {
        flex-direction: column;
    }
    #sidebar {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    .nav-btn {
        width: calc(50% - 3px);
    }
}
