/**
 * Part of LinkMyGoals.com project.
 * GitHub: https://github.com/ChadsCode/LinkMyGoals
 * License: MIT Open-Source
 * Website: https://www.linkmygoals.com/
 *
 * Copyright (c) 2025 Chad Wigington
 * LinkedIn: https://www.linkedin.com/in/chadwigington/
 */

.form-section {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-half {
    flex: 1;
}

.form-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.label-optional {
    font-weight: 400;
    color: var(--text-muted);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    font-size: 16px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--linkedin-blue);
    box-shadow: 0 0 0 3px var(--linkedin-blue-alpha);
}

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

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Stage Selector */
.stage-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stage-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.stage-btn:hover {
    border-color: var(--linkedin-blue);
    background: var(--linkedin-blue-alpha);
}

.stage-btn.active {
    border-color: var(--linkedin-blue);
    background: var(--linkedin-blue-alpha);
    box-shadow: 0 0 0 2px var(--linkedin-blue-alpha);
}

.stage-icon {
    font-size: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pearl);
    border-radius: 8px;
}

.stage-btn.active .stage-icon {
    background: var(--pure);
}

.stage-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.stage-desc {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

/* Length Selector */
.length-selector {
    display: flex;
    gap: 8px;
}

.length-btn {
    flex: 1;
    padding: 10px 8px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.length-btn:hover {
    border-color: var(--linkedin-blue);
    background: var(--linkedin-blue-alpha);
}

.length-btn.active {
    border-color: var(--linkedin-blue);
    background: var(--linkedin-blue-alpha);
    box-shadow: 0 0 0 2px var(--linkedin-blue-alpha);
}

.length-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.length-chars {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Accordion */
.accordion-toggle {
    width: 100%;
    padding: 12px;
    background: var(--pearl);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.2s;
}

.accordion-toggle:hover {
    background: var(--ash);
}

.accordion-hint {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: auto;
}

.accordion-arrow {
    transition: transform 0.2s;
    color: var(--text-secondary);
}

.accordion-toggle.open .accordion-arrow {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-content.open {
    max-height: 500px;
    padding-top: 12px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label-sm {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.form-select:focus {
    outline: none;
    border-color: var(--linkedin-blue);
    box-shadow: 0 0 0 3px var(--linkedin-blue-alpha);
}

/* Update Context Button */
.btn-update-context {
    width: 100%;
    padding: 12px 16px;
    background: var(--linkedin-blue);
    color: var(--pure);
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    margin-top: 24px;
}

.btn-update-context:hover {
    background: var(--linkedin-blue-dark);
}

.btn-update-context:active {
    transform: scale(0.98);
}

/* Fix datalist input - ensure dropdown arrow always visible */
input[list] {
    cursor: pointer;
}

input[list]::-webkit-calendar-picker-indicator {
    opacity: 1;
    cursor: pointer;
}

/* Inline Autocomplete */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-input {
    position: relative;
    z-index: 2;
    background: var(--surface);
    width: 100%;
}

.autocomplete-suggestion {
    position: absolute;
    left: 1px;
    top: 1px;
    right: 1px;
    bottom: 1px;
    padding: 12px 14px;
    font-size: 15px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
    overflow: hidden;
    border-radius: 7px;
    background: var(--surface);
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 4px;
    display: none;
}

.autocomplete-dropdown.visible {
    display: block;
}

.autocomplete-option {
    padding: 12px 14px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}

.autocomplete-option:last-child {
    border-bottom: none;
}

.autocomplete-option:hover,
.autocomplete-option.highlighted {
    background: var(--pearl);
}

.autocomplete-option mark {
    background: rgba(10, 102, 194, 0.15);
    color: var(--linkedin-blue);
    font-weight: 600;
    padding: 0;
}

.form-input.over-limit {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(178, 64, 32, 0.15);
}

.form-textarea.over-limit {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(178, 64, 32, 0.15);
}

.writing-sample-count {
    text-align: right;
    margin-top: 4px;
}

.writing-sample-count.over-limit {
    color: var(--danger);
    font-weight: 600;
}