/* Thought Bubble - Stylesheet */

/* Input section */
.input-section {
    margin-bottom: 1rem;
}

.input-section label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input-section textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    resize: vertical;
    transition: border-color 0.15s ease;
}

.input-section textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.input-section textarea::placeholder {
    color: var(--text-muted);
}

/* Options section */
.options-section {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.option-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.option-group input[type="number"] {
    width: 80px;
    padding: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    transition: border-color 0.15s ease;
}

.option-group input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
}

/* Font picker */
.font-picker {
    position: relative;
}

.font-picker-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.15s ease;
    min-width: 160px;
    justify-content: space-between;
}

.font-picker-btn:hover {
    border-color: var(--accent);
}

.font-picker.open .font-picker-btn {
    border-color: var(--accent);
}

.font-picker-btn svg {
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.font-picker.open .font-picker-btn svg {
    transform: rotate(180deg);
}

.font-picker-label {
    font-size: 1rem;
}

.font-picker-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    z-index: 100;
    display: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    max-height: 240px;
    overflow-y: auto;
}

.font-picker.open .font-picker-dropdown {
    display: block;
}

.font-picker-option {
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: background 0.1s ease;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.font-picker-option:first-child {
    border-radius: 6px 6px 0 0;
}

.font-picker-option:last-child {
    border-radius: 0 0 6px 6px;
}

.font-picker-option:hover {
    background: var(--bg-secondary);
}

.font-picker-option.selected {
    background: var(--accent);
    color: white;
}

/* Tail position picker */
.tail-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    padding: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 52px;
    height: 40px;
}

.tail-corner {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.tail-corner:hover {
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.tail-corner.selected {
    background: var(--accent);
    border-color: var(--accent);
}

.tail-corner.selected::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 5px;
    background: white;
    border-radius: 50%;
}

.tail-corner[data-position="topLeft"].selected::after {
    top: 2px;
    left: 2px;
}

.tail-corner[data-position="topRight"].selected::after {
    top: 2px;
    right: 2px;
}

.tail-corner[data-position="bottomLeft"].selected::after {
    bottom: 2px;
    left: 2px;
}

.tail-corner[data-position="bottomRight"].selected::after {
    bottom: 2px;
    right: 2px;
}

/* Format toggle */
.format-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.format-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--bg-secondary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.format-btn:not(:last-child) {
    border-right: 1px solid var(--border);
}

.format-btn:hover {
    color: var(--text-primary);
}

.format-btn.active {
    background: var(--accent);
    color: white;
}

/* Output section */
.output-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
}

.output-title {
    font-weight: 600;
    font-size: 0.875rem;
}

.output-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.output {
    margin: 0;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.4;
    overflow-x: auto;
    white-space: pre;
    color: var(--text-primary);
}

.output-png {
    padding: 1rem;
    display: flex;
    justify-content: center;
    background: repeating-conic-gradient(#e0e0e0 0% 25%, #ffffff 0% 50%) 50% / 16px 16px;
}

[data-theme="light"] .output-png {
    background: repeating-conic-gradient(#e0e0e0 0% 25%, #ffffff 0% 50%) 50% / 16px 16px;
}

.output-png canvas {
    max-width: 100%;
    height: auto;
}

/* Split export button */
.split-button {
    position: relative;
    display: inline-flex;
}

.split-button-main {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px 0 0 6px;
    transition: background 0.15s ease;
}

.split-button-main:hover {
    background: var(--accent-hover);
}

.split-button-main:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.split-button-toggle {
    background: var(--accent);
    color: white;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    border-radius: 0 6px 6px 0;
    display: flex;
    align-items: center;
    transition: background 0.15s ease;
}

.split-button-toggle:hover {
    background: var(--accent-hover);
}

.split-button.open .split-button-toggle {
    background: var(--accent-hover);
}

.split-button-toggle svg {
    transition: transform 0.15s ease;
}

.split-button.open .split-button-toggle svg {
    transform: rotate(180deg);
}

.split-button-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    min-width: 180px;
    z-index: 100;
    display: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.split-button.open .split-button-dropdown {
    display: block;
}

.split-button-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.1s ease;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.split-button-option:first-child {
    border-radius: 6px 6px 0 0;
}

.split-button-option:last-child {
    border-radius: 0 0 6px 6px;
}

.split-button-option:hover {
    background: var(--bg-secondary);
}

.split-button-option.selected {
    background: var(--accent);
    color: white;
}

/* Responsive - tool specific */
@media (max-width: 640px) {
    .options-section {
        flex-direction: column;
        gap: 1rem;
    }

    .output {
        font-size: 0.75rem;
    }
}
