:root {
    --primary: #2d2d2d;
    --background: #f5f5f5;
    --surface: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #666666;
    --border: #e0e0e0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--background);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

#ws-status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: red; /* Default to red (offline) */
}

.wavefont-txt {
    font-family: "Wavefont", system-ui;
    font-optical-sizing: auto;
    font-size: 20px;
    line-height: 3;
    color: #999;
    font-style: normal;
    font-variation-settings:
      "ROND" 0,
      "YELA" 0;
  }

.app {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
}

.title {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--primary);
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.button {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.2s ease;
}

.button:hover {
    opacity: 0.9;
}

.show-config-button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

.show-config-button input {
    display: none;
}



@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.9; }
    50% { transform: scale(1.1); opacity: 0.5; }
    100% { transform: scale(0.95); opacity: 0.9; }
}

.config-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 1.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;
    padding: 0;
}

body:has(#show-config-checkbox:checked) .config-panel {
    max-height: 900px;
    padding: 1.5rem;
}

.show-experimental-button {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.875rem;
    margin-top: 1rem;
}

#show-experimental {
    display: none;
}

body:has(#show-experimental:checked) .experimental-config {
    max-height: 1000px;
    padding: 1rem;
}

.config-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.config-row:last-child {
    margin-bottom: 0;
}

.config-row label {
    min-width: 120px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding-top: 0.5rem;
}

.config-row select,
.config-row textarea {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.875rem;
    background: var(--surface);
    color: var(--text);
}

.config-row select:focus,
.config-row textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.convo-prompt-row {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;
}

.voice-select-row {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;
}

.summary-off-msg {
    display: none;
}

body:not(:has(#enable-summary:checked)) .summary-off-msg {
    display: block !important;
}

body:not(:has(#enable-summary:checked)) #summary-content {
    display: none !important;
}

body:has(#enable-summary:checked) .summary-config {
    max-height: 200px;
    padding: 1rem;
}

body:has(#enable-convo:checked) .convo-prompt-row {
    max-height: 200px;
    padding: 1rem;
}

body:has(#enable-tts:checked) .voice-select-row {
    max-height: 200px;
    padding: 1rem;
}

.summary-config {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;
}

.experimental-config {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;
    padding: 0;
}

.experimental-config.active {
    max-height: 300px;
    padding: 1rem;
}

.content {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
    height: calc(100vh - 200px);
}

.section {
    flex: 1;
    width: 50%;
    min-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.section-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.transcription-box {
    
}

.conversation-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#conversation {
    display: block;
    flex: 1;
    overflow-y: auto;
    height: 100%;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-size: 0.9375rem;
    line-height: 1.7;
    min-height: 0;
    margin-bottom: auto;
}

#conversation:empty::before {
    content: "Empty";
    display: block;
    color: var(--text-secondary);
    text-align: center;
    padding: 1rem;
}

.input-container {
    display: none;
    gap: 0.75rem;
    padding: 10px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

#user-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9375rem;
    transition: border-color 0.2s ease;
}

#user-input:focus {
    outline: none;
    border-color: var(--primary);
}

#send-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

#send-btn:hover {
    opacity: 0.9;
}

#summary-content {
    flex: 1;
    overflow-y: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-size: 0.9375rem;
    line-height: 1.7;
    min-height: 0;
}

/* Only apply stacking at very small screens */
@media (max-width: 800px) {
    .content {
        flex-direction: column;
    }

    .section {
        width: 100%;
        min-width: 0;
        height: 50vh;
    }
}

.experimental-toggle {
    cursor: pointer;
    color: var(--primary);
    text-decoration: underline;
    background: none;
    border: none;
    font-size: 0.875rem;
}

.fade-in-word {
    opacity: 0;
    animation: fadeInWord 0.5s forwards;
}

@keyframes fadeInWord {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

main.content {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two columns of equal width */
    grid-template-rows: repeat(10, 1fr); /* Ten rows of equal height */
    height: calc(100vh - 60px - 200px); /* Adjust based on header and config-panel heights */
    gap: 10px;                      /* Space between grid items */
    padding: 10px;                  /* Padding around the grid */
    width: 70vw;
    margin: auto;
}

/* Left Top Quadrant (Render Container) */
.left-top {
    grid-column: 1 / 2;
    grid-row: 1 / 11; /* Span first 3 rows */
    background-color: transparent; /* Optional: Background color */
}

/* Left Bottom Quadrant (Transcription) */
.left-bottom {
    grid-column: 1 / 2;
    grid-row: 4 / 11; /* Span remaining 7 rows */
    background-color: #ffffff; /* Optional: Background color */
    border: 1px solid #ddd;    /* Optional: Border */
    border-radius: 8px;        /* Optional: Rounded corners */
    padding: 20px;             /* Padding inside the transcription pane */
    overflow-y: auto;          /* Enable scrolling if content overflows */
}

/* Right Side (Combined Top-Right & Bottom-Right Quadrants) */
.right {
    grid-column: 2 / 3;
    grid-row: 1 / 11; /* Span all 10 rows */
    background-color: #ffffff; /* Optional: Background color */
    border: 1px solid #ddd;    /* Optional: Border */
    border-radius: 8px;        /* Optional: Rounded corners */
    padding: 20px;             /* Padding inside the summary pane */
    overflow-y: auto;          /* Enable scrolling if content overflows */
}

/* Responsive Design: Stack vertically on smaller screens */
@media (max-width: 768px) {
    main.content {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(3, auto);
        height: auto; /* Adjust height for content */
    }

    .right {
        grid-row: 3 / 4; /* Move to the bottom */
    }
    
    .left-top {
        height: 25vh; /* Maintain 25% height on mobile */
        grid-row: 1 / 2;
    }
    
    .left-bottom {
        height: 75vh; /* Maintain 75% height on mobile */
        grid-row: 2 / 3;
    }
}

/* Ensure render content (image or canvas) fits without margins */
#renderContainer {
    height: 28%;
    margin: auto;
    margin-top: 0px;
    display: block;
}

svg path,
svg rect{
  fill: #777;
}

.stt-backend-cfg {
    display: none;
}

.whisper-model-cfg {
    display: none;
}

.ws-status {
    display: none;
}

.record-indicator {
    width: 8px;
    height: 8px;
    background: #dc2626;
    border-radius: 50%;
    display: none;
}

.record-indicator.active {
    display: block;
    animation: pulse 1.5s infinite;
}

#loadingSpinner svg {
    margin: auto;
    display: block;
    position: relative;
    top: 50px;
}