/* Discuss page styles */

body {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #3730a3 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.discuss-container {
    max-width: 700px;
    margin: 0 auto;
    padding: var(--spacing-xl);
    padding-top: 100px;
    padding-bottom: 120px;
}

.header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.header h1 {
    margin: 0 0 var(--spacing-sm) 0;
    font-size: var(--font-size-3xl);
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.header-intro {
    color: rgba(255, 255, 255, 0.85);
    font-size: var(--font-size-lg);
    line-height: 1.6;
}

/* Queue Status Card */
.queue-status {
    background: rgba(139, 92, 246, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    text-align: center;
    display: none;
}

.queue-status.active {
    display: block;
}

.queue-position {
    font-size: 4rem;
    font-weight: 700;
    color: #a78bfa;
    display: block;
    margin-bottom: var(--spacing-sm);
}

.queue-label {
    color: rgba(255, 255, 255, 0.85);
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-md);
}

.queue-message {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-lg);
}

.cancel-btn {
    padding: var(--spacing-sm) var(--spacing-xl);
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--border-radius);
    color: #fca5a5;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cancel-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* AI Option */
.ai-option {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--border-radius);
}

.ai-option-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: var(--font-size-sm);
    margin: 0 0 var(--spacing-sm) 0;
}

.ai-match-btn {
    padding: var(--spacing-sm) var(--spacing-xl);
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: var(--border-radius);
    color: #6ee7b7;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-match-btn:hover {
    background: rgba(16, 185, 129, 0.3);
}

.ai-match-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Form Card */
.form-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: var(--spacing-xl);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 10;
}

.form-card.hidden {
    display: none;
}

.form-section {
    margin-bottom: var(--spacing-xl);
}

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

.form-label {
    display: block;
    font-weight: 600;
    color: var(--color-neutral-800);
    margin-bottom: var(--spacing-sm);
}

.form-hint {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--color-neutral-500);
    margin-bottom: var(--spacing-sm);
}

/* Custom Dropdown */
.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    padding-right: 40px;
    border: 2px solid var(--color-neutral-300);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    background: white;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    color: var(--color-neutral-800);
}

.custom-select-trigger.placeholder {
    color: var(--color-neutral-500);
}

.custom-select-trigger:hover {
    border-color: var(--color-neutral-400);
}

.custom-select-trigger:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.custom-select.open .custom-select-trigger {
    border-color: #8b5cf6;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.custom-select-arrow {
    position: absolute;
    right: var(--spacing-md);
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: transform 0.2s ease;
    color: var(--color-neutral-500);
}

.custom-select.open .custom-select-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #8b5cf6;
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    max-height: 280px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.custom-select.open .custom-select-options {
    display: block;
}

.custom-select-option {
    padding: var(--spacing-xs) var(--spacing-md);
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid var(--color-neutral-100);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-size-sm);
}

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

.custom-select-option:hover {
    background: #f5f3ff;
}

.custom-select-option.selected {
    background: #8b5cf6;
    color: white;
}

.custom-select-option.selected:hover {
    background: #7c3aed;
}

.custom-select-options::-webkit-scrollbar {
    width: 8px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: var(--color-neutral-100);
    border-radius: 4px;
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: var(--color-neutral-300);
    border-radius: 4px;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
    background: var(--color-neutral-400);
}

/* Dropdown groups */
.custom-select-group {
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--color-neutral-100);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-neutral-500);
    border-bottom: 1px solid var(--color-neutral-200);
}

.custom-select-group.community {
    background: #fef3c7;
    color: #92400e;
}

/* Create topic link button */
.create-topic-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: var(--spacing-sm);
    padding: 0;
    background: none;
    border: none;
    color: #6366f1;
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}

.create-topic-link:hover {
    color: #4f46e5;
}

.create-topic-link svg {
    flex-shrink: 0;
}

/* Search input in dropdown */
.custom-select-search {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-bottom: 1px solid var(--color-neutral-200);
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.custom-select-search input {
    width: 100%;
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid var(--color-neutral-300);
    border-radius: 6px;
    font-size: var(--font-size-sm);
    outline: none;
}

.custom-select-search input:focus {
    border-color: #8b5cf6;
}

.custom-select-search input::placeholder {
    color: var(--color-neutral-400);
}

.custom-select-no-results {
    padding: var(--spacing-md);
    text-align: center;
    color: var(--color-neutral-500);
    font-size: var(--font-size-sm);
}

/* Stance Spectrum */
.stance-spectrum {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.stance-option {
    flex: 1;
    min-width: 120px;
    padding: var(--spacing-md);
    border: 2px solid var(--color-neutral-300);
    border-radius: var(--border-radius);
    background: white;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
}

.stance-option:hover {
    border-color: #8b5cf6;
    background: #f5f3ff;
}

.stance-option.selected {
    border-color: #8b5cf6;
    background: #8b5cf6;
    color: white;
}

.stance-option-position {
    font-size: var(--font-size-xs);
    font-weight: 700;
    margin-bottom: 4px;
    opacity: 0.7;
}

.stance-option-label {
    font-weight: 600;
    font-size: var(--font-size-sm);
    line-height: 1.3;
}

/* Stance info tooltip */
.stance-info-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-neutral-200);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-neutral-600);
    transition: all 0.2s;
    z-index: 1;
}

.stance-info-btn:hover {
    background: var(--color-neutral-300);
    color: var(--color-neutral-800);
}

.stance-option.selected .stance-info-btn {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.stance-option.selected .stance-info-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Tooltip popup */
.stance-tooltip {
    position: fixed;
    background: white;
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    padding-top: var(--spacing-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--color-neutral-200);
    max-width: 300px;
    z-index: 2000;
    display: none;
}

.stance-tooltip-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: var(--color-neutral-100);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-neutral-500);
    transition: all 0.2s;
}

.stance-tooltip-close:hover {
    background: var(--color-neutral-200);
    color: var(--color-neutral-700);
}

.stance-tooltip.visible {
    display: block;
}

.stance-tooltip-title {
    font-weight: 700;
    color: var(--color-neutral-800);
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-sm);
}

.stance-tooltip-subtitle {
    font-size: var(--font-size-xs);
    color: #7c3aed;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.stance-tooltip-text {
    font-size: var(--font-size-sm);
    color: var(--color-neutral-600);
    line-height: 1.5;
}

/* Textarea with counter */
.textarea-container {
    position: relative;
}

.form-textarea {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--color-neutral-300);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    box-sizing: border-box;
}

.form-textarea:focus {
    outline: none;
    border-color: #8b5cf6;
}

.char-counter {
    position: absolute;
    bottom: var(--spacing-sm);
    right: var(--spacing-sm);
    font-size: var(--font-size-xs);
    color: var(--color-neutral-500);
}

.char-counter.warning {
    color: #f59e0b;
}

.char-counter.error {
    color: #dc2626;
}

/* Optional section */
.optional-section {
    padding: var(--spacing-lg);
    background: #f5f3ff;
    border-radius: var(--border-radius);
    border: 1px solid #e9d5ff;
}

.optional-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
    color: var(--color-neutral-800);
    margin-bottom: var(--spacing-xs);
}

.optional-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #e9d5ff;
    color: #7c3aed;
    border-radius: 4px;
    font-size: var(--font-size-xs);
    font-weight: 600;
}

/* Party affiliation field */
.party-select {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--color-neutral-300);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.party-select:focus {
    outline: none;
    border-color: #8b5cf6;
}

.party-info-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-neutral-200);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-neutral-600);
    transition: all 0.2s;
    margin-left: var(--spacing-xs);
}

.party-info-btn:hover {
    background: var(--color-neutral-300);
    color: var(--color-neutral-800);
}

.party-info-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.party-info-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--color-neutral-200);
    width: 280px;
    z-index: 100;
}

.party-info-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: white;
}

.party-info-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 9px solid transparent;
    border-top-color: var(--color-neutral-200);
}

.party-info-wrapper:hover .party-info-tooltip,
.party-info-tooltip.visible {
    display: block;
}

.party-info-tooltip strong {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--color-neutral-800);
    margin-bottom: var(--spacing-xs);
}

.party-info-tooltip p {
    font-size: var(--font-size-sm);
    color: var(--color-neutral-600);
    line-height: 1.5;
    margin: 0;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: var(--font-size-lg);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.submit-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Details Section */
.details-section {
    margin-top: var(--spacing-xl);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.details-section h2 {
    font-size: var(--font-size-lg);
    color: var(--color-neutral-800);
    margin: 0 0 var(--spacing-md) 0;
}

.details-section p {
    color: var(--color-neutral-600);
    line-height: 1.7;
    margin: 0 0 var(--spacing-lg) 0;
}

.details-section p:last-child {
    margin-bottom: 0;
}

.details-subsection {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--color-neutral-200);
}

.details-subsection h3 {
    font-size: var(--font-size-base);
    color: var(--color-neutral-700);
    margin: 0 0 var(--spacing-sm) 0;
}

.example-conversation {
    background: var(--color-neutral-100);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    font-size: var(--font-size-sm);
}

.example-message {
    margin-bottom: var(--spacing-sm);
}

.example-message:last-child {
    margin-bottom: 0;
}

.example-sender {
    font-weight: 600;
    color: var(--color-neutral-700);
}

.example-text {
    color: var(--color-neutral-600);
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--spacing-md);
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
}

.modal-header {
    padding: var(--spacing-lg) var(--spacing-xl);
    border-bottom: 1px solid var(--color-neutral-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.modal-header h2 {
    margin: 0;
    font-size: var(--font-size-xl);
    color: var(--color-neutral-900);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--color-neutral-100);
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-neutral-600);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--color-neutral-200);
    color: var(--color-neutral-900);
}

.modal-body {
    padding: var(--spacing-xl);
}

.modal-form-group {
    margin-bottom: var(--spacing-lg);
}

.modal-form-label {
    display: block;
    font-weight: 600;
    color: var(--color-neutral-800);
    margin-bottom: var(--spacing-xs);
}

.modal-form-hint {
    font-size: var(--font-size-sm);
    color: var(--color-neutral-500);
    margin-bottom: var(--spacing-sm);
}

.modal-input, .modal-textarea {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--color-neutral-300);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.modal-input:focus, .modal-textarea:focus {
    outline: none;
    border-color: #8b5cf6;
}

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

.modal-char-count {
    text-align: right;
    font-size: var(--font-size-sm);
    color: var(--color-neutral-500);
    margin-top: 4px;
}

.modal-char-count.warning { color: #f97316; }
.modal-char-count.error { color: #ef4444; }

/* Stances in modal */
.modal-stances-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.modal-stances-title {
    font-weight: 600;
    color: var(--color-neutral-800);
}

.modal-stance-counter {
    font-size: var(--font-size-sm);
    color: var(--color-neutral-500);
}

.modal-stance-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.modal-stance-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.modal-stance-number {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e9d5ff 0%, #c4b5fd 100%);
    color: #6d28d9;
    border-radius: 50%;
    font-size: var(--font-size-xs);
    font-weight: 700;
    flex-shrink: 0;
}

.modal-stance-input {
    flex: 1;
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 2px solid var(--color-neutral-300);
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
}

.modal-stance-input:focus {
    outline: none;
    border-color: #8b5cf6;
}

.modal-remove-stance {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fee2e2;
    border: none;
    border-radius: var(--border-radius);
    color: #dc2626;
    cursor: pointer;
}

.modal-remove-stance:hover:not(:disabled) {
    background: #fecaca;
}

.modal-remove-stance:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.modal-add-stance {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: var(--spacing-xs);
    margin-top: var(--spacing-sm);
    background: #f5f3ff;
    border: 2px dashed #c4b5fd;
    border-radius: var(--border-radius);
    color: #7c3aed;
    font-weight: 600;
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.modal-add-stance:hover:not(:disabled) {
    background: #e9d5ff;
}

.modal-add-stance:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-footer {
    padding: var(--spacing-lg) var(--spacing-xl);
    border-top: 1px solid var(--color-neutral-200);
    display: flex;
    gap: var(--spacing-md);
}

.modal-cancel-btn {
    flex: 1;
    padding: var(--spacing-md);
    background: white;
    border: 2px solid var(--color-neutral-300);
    border-radius: var(--border-radius);
    color: var(--color-neutral-700);
    font-weight: 600;
    cursor: pointer;
}

.modal-cancel-btn:hover {
    background: var(--color-neutral-100);
}

.modal-submit-btn {
    flex: 2;
    padding: var(--spacing-md);
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    border: none;
    border-radius: var(--border-radius);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.modal-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.modal-error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: var(--border-radius);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-md);
    color: #dc2626;
    font-size: var(--font-size-sm);
    display: none;
}

.modal-error.visible {
    display: block;
}

@media (max-width: 768px) {
    .discuss-container {
        padding-top: 80px;
    }

    .header h1 {
        font-size: var(--font-size-2xl);
    }

    .stance-spectrum {
        flex-direction: column;
    }

    .stance-option {
        min-width: unset;
    }
}
