/* General Body and Page Layout */
body {
    font-family: sans-serif;
    margin-right: 350px; /* Space for the chat pane */
    position: relative;
}

/* --- Training Plan Styles --- */

.date-controls {
    text-align: center;
    margin: 20px 0;
    position: relative; /* Added for positioning locale selector */
}

.date-controls button {
    padding: 5px 10px;
    margin: 0 10px;
}

#date-display {
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2em;
}

.locale-selector {
    position: absolute;
    top: 0;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.locale-selector .flag-icon {
    width: 24px;
    height: 16px;
    border: 1px solid #ccc;
}

.locale-selector select {
    padding: 5px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

.accordion {
    border: 1px solid #ccc;
    margin-bottom: 10px;
}

.accordion-header {
    background-color: #f0f0f0;
    padding: 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-header h3 {
    margin: 0;
}

.accordion-header .category-reps {
    font-size: 0.9em;
    color: #555;
}

.accordion-content {
    padding: 10px;
    display: none; /* Hidden by default */
}

.accordion-content.show {
    display: block;
}

.drill {
    margin-bottom: 5px;
    padding: 5px;
    border-bottom: 1px solid #eee;
}

.drill-name {
    font-weight: bold;
}

.drill-desc {
    font-size: 0.9em;
    color: #333;
    margin-top: 3px;
}

.drill-controls {
    margin-top: 5px;
    display: flex;
    align-items: center;
}

.drill-controls button {
    padding: 3px 8px;
    margin: 0 5px;
}

.drill-repetition {
    width: 50px;
    padding: 3px;
    margin: 0 5px;
    text-align: center;
}

.drill-note-input {
    flex-grow: 1;
    padding: 3px;
    margin-left: 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9em;
}

.read-only {
    pointer-events: none;
    opacity: 0.7;
}


/* --- Chat Pane Styles --- */

#chat-pane {
    position: fixed;
    right: 0;
    top: 0;
    width: 350px;
    height: 100%;
    border-left: 1px solid #ccc;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

#chat-history {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

.chat-message {
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 18px;
    max-width: 90%;
    word-wrap: break-word;
}

.chat-message.user {
    background-color: #dcf8c6;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.agent {
    background-color: #e6e6e6;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

#chat-input-area {
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-top: 1px solid #ccc;
    background-color: #fff;
}

/* --- Chat Input Area Controls --- */

.stream-controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 15px; /* row-gap column-gap */
    margin-bottom: 10px;
    font-size: 0.9em;
}

.stream-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#vad-controls {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 5px;
}

#vad-controls span {
    margin-right: 10px;
    font-size: 0.8em;
}

#vu-meter {
    flex-grow: 1;
    height: 10px;
    background-color: #e0e0e0;
    border: 1px solid #ccc;
    border-radius: 5px;
    overflow: hidden;
}

#vu-meter-level {
    width: 0%;
    height: 100%;
    background-color: #4caf50;
    transition: width 0.05s ease-out;
}

.mic-gain-control {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 5px;
    font-size: 0.8em;
}

.mic-gain-control input[type="range"] {
    flex-grow: 1;
    margin-left: 10px;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #d3d3d3;
    outline: none;
    opacity: 0.7;
    -webkit-transition: .2s;
    transition: opacity .2s;
    border-radius: 2px;
}

.mic-gain-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
}

.mic-gain-control input[type="range"]::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
}

.message-controls-row {
    display: flex;
    width: 100%;
    align-items: center;
    margin-top: 5px;
}

#chat-message-input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 18px;
    margin-right: 5px;
}

#chat-send-button, #chat-delete-session-button {
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    margin-left: 5px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

#chat-delete-session-button {
    background-color: #dc3545;
}

.mic-toggle {
    margin: 0 5px;
}

/* --- Toggle Switch (Slider) Styles --- */

.switch {
    position: relative;
    display: inline-block;
    width: 32px;  /* Further reduced size */
    height: 18px; /* Further reduced size */
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 12px; /* Further reduced size */
    width: 12px;  /* Further reduced size */
    left: 3px;    /* Adjusted position */
    bottom: 3px;  /* Adjusted position */
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
    transform: translateX(14px); /* Adjusted travel distance */
}

.slider.round {
    border-radius: 18px; /* Adjusted for new height */
}

.slider.round:before {
    border-radius: 50%;
}

.flag-icon {
    width: 24px;
    height: 18px;
    border: 1px solid #ccc;
    border-radius: 2px;
    object-fit: cover;
}

.locale-selector {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}