/* Input Interface and Form Controls Styles */

/* Status Feedback Section */
.status-section {
    margin-bottom: 0;
}

#inputView {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

#inputView .status-section {
    flex: 0 0 auto;
}

.status-message {
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
    margin-top: 0.5rem;
    padding: 8px;
    background: rgba(26, 26, 26, 0.6);
    border-radius: 6px;
    display: none;
}

.status-message.show {
    display: block;
}

.status-message.error {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.status-message.success {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.status-message.tip {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.22);
}

#inputView .text-input-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 0;
    margin-top: 0;
    max-height: 100%;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease, margin-top 0.3s ease;
}

.text-input-wrapper {
    position: relative;
}

#inputView #textInput {
    width: 100%;
    min-height: 180px;
    height: clamp(180px, 32vh, 360px);
    max-height: clamp(180px, 32vh, 360px);
    padding: 0;
    border: none;
    border-radius: 0;
    font-family: inherit;
    font-weight: 400;
    font-size: var(--input-text-font-size);
    line-height: 1.55;
    letter-spacing: 0.01em;
    color: var(--input-text-color);
    background: transparent;
    resize: none;
    overflow-y: auto;
    opacity: 1.0;
    transition: opacity 0.3s ease, color 0.3s ease;
}

#inputView #textInput::placeholder {
    color: var(--input-placeholder-color);
    opacity: 1.0;
}

#inputView #textInput:focus {
    outline: none;
    opacity: 1.0;
}

.privacy-tail-controls {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.privacy-tail-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.privacy-tail-label {
    font-size: 12px;
    color: #d1d5db;
}

.privacy-tail-input {
    min-height: 70px;
    height: 78px;
    max-height: 180px;
    padding: 8px 10px;
    border: 1px solid rgba(107, 114, 128, 0.35);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.28);
    color: #f3f4f6;
    font-size: 13px;
    line-height: 1.4;
    resize: vertical;
    overflow-y: auto;
}

.privacy-tail-input:focus {
    border-color: #fbbf24;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.char-counter {
    position: absolute;
    bottom: 10px;
    right: 14px;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.01em;
    opacity: 0;
    transition: opacity 0.3s ease, color 0.3s ease;
    pointer-events: none;
    padding: 0;
    background: transparent;
    border-radius: 0;
    color: rgba(255, 255, 255, 0.52);
}

.char-counter.show {
    opacity: 0.85;
}

.char-counter.warning {
    color: rgba(255, 120, 120, 0.9);
}

.char-counter.danger {
    color: #f87171;
}

.draft-history {
    position: relative;
    margin-top: 12px;
    width: 100%;
}

.draft-history-toggle {
    width: 150px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(31, 41, 55, 0.6);
    border-radius: 6px;
    color: #f3f4f6;
    font-size: 12px;
    cursor: pointer;
    text-align: left;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.draft-history-toggle:hover:not(:disabled) {
    border-color: #fbbf24;
    transform: translateY(-1px);
}

/* disabled state handled globally in styles-core.css */

.draft-history-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 220px;
    max-height: 260px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 6px 0;
    display: none;
    z-index: 30;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

.draft-history-menu.visible {
    display: block;
}

.draft-history-entry,
.draft-history-empty {
    width: 100%;
    background: transparent;
    border: none;
    color: #e5e7eb;
    padding: 8px 12px;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    display: block;
}

.draft-history-entry:hover {
    background: rgba(255, 255, 255, 0.08);
}

.draft-history-empty {
    cursor: default;
    opacity: 0.6;
}

/* Controls Section */
.controls-section {
    margin-bottom: 1.5rem;
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 4px 0;
    flex-wrap: wrap;
    font-size: 12px;
}

.control-row label {
    color: #9ca3af;
    margin-right: 8px;
}

/* Generate Control */
.generate-control {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Voice Controls */
.voice-controls {
    display: flex;
    gap: 0.5rem;
}

.voice-btn {
    background: transparent;
    border: 1px solid #4b5563;
    color: #9ca3af;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-btn.selected {
    background: #6b7280;
    border-color: #6b7280;
    color: #fff;
}

/* Speed Control */
.speed-slider {
    width: 80px;
    height: 4px;
    background: rgba(64, 64, 64, 0.3);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #6b7280;
    cursor: pointer;
}

.speed-value {
    color: #9ca3af;
    font-size: 11px;
    min-width: 40px;
}

/* Speaker Toggle */
.speaker-toggle {
    display: flex;
    background: rgba(64, 64, 64, 0.3);
    border-radius: 20px;
    border: 1px solid rgba(107, 114, 128, 0.3);
    overflow: hidden;
    padding: 2px;
}

.speaker-btn {
    padding: 6px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    border-radius: 16px;
}

.speaker-btn.selected {
    background: #6b7280;
    color: #ffffff;
}

/* Override Control */
.override-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox {
    width: 16px;
    height: 16px;
    appearance: none;
    background: rgba(64, 64, 64, 0.3);
    border: 2px solid rgba(107, 114, 128, 0.3);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    margin-right: 0.5rem;
}

.checkbox:checked {
    background: #6b7280;
    border-color: #6b7280;
}

.checkbox:checked::after {
    content: '✓';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.checkbox-label {
    font-size: 14px;
    color: #9ca3af;
    cursor: pointer;
    user-select: none;
}

.override-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(107, 114, 128, 0.3);
    border-radius: 6px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    background: rgba(64, 64, 64, 0.3);
    color: #e5e7eb;
}

.override-input:focus {
    outline: none;
    border-color: #6b7280;
}

/* Advanced Controls */
.advanced-controls {
    margin-top: 8px;
    padding: 8px;
    background: rgba(64, 64, 64, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(107, 114, 128, 0.2);
}

.toggle-controls-btn {
    background: transparent;
    border: 1px solid #4b5563;
    color: #9ca3af;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.toggle-controls-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: #6b7280;
}

/* Input text surface owns geometry for textarea+counter only in input mode */
#inputView .input-text-content {
    --input-text-content-width: calc(100% - 20px);
    --input-text-content-margin-inline: 0;
    position: relative;
    overflow: hidden;
    width: var(--input-text-content-width);
    max-width: var(--input-text-content-width);
    margin-inline: var(--input-text-content-margin-inline);
    padding: 14px var(--input-text-content-padding-inline, 16px) 30px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: #000000;
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.3);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

#inputView .input-text-content:focus-within {
    border-color: var(--reader-selection-border-color, rgba(251, 191, 36, 0.75));
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.2), 0 18px 28px rgba(0, 0, 0, 0.32);
}

/* Refresh Button */
.refresh-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-right: auto;
}

.refresh-btn:hover {
    transform: rotate(180deg);
}

.refresh-btn:active {
    transform: rotate(180deg) scale(0.95);
}
