/**
 * Create Thread Page Styles
 * Reddit-style post creation interface
 */

/* Create Thread Container */
.create-thread-container {
    max-width: 740px;
    margin: 24px auto;
    padding: 0 16px;
}

.create-thread-header {
    margin-bottom: 16px;
}

.create-thread-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

/* Post Type Tabs */
.post-type-tabs {
    display: flex;
    background-color: var(--bg-primary);
    border-radius: 4px 4px 0 0;
    border-bottom: none;
    overflow: hidden;
}

.post-type-tab {
    flex: 1;
    padding: 10px 5px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.post-type-icon {
    width: 18px;
    height: 18px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.post-type-tab.active .post-type-icon {
    opacity: 1;
}

.post-type-tab:last-child {
    border-right: none;
}

.post-type-tab:hover {
    background-color: var(--bg-hover);
}

.post-type-tab.active {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.post-type-icon {
    font-size: 18px;
}

/* Create Thread Form */
.create-thread-form {
    background-color: var(--bg-primary);
    border-radius: 0 0 4px 4px;
    padding: 16px 3px;
}

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

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

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.circle-select-wrapper {
    position: relative;
}

/* Hidden native select (for form value) */
.circle-select-hidden {
    display: none;
}

/* Original select - kept for backwards compatibility */
.circle-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.circle-select:hover {
    border-color: var(--text-secondary);
}

.circle-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

/* Custom Circle Dropdown */
.circle-dropdown-trigger {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
}

.circle-dropdown-trigger:hover {
    border-color: var(--text-secondary);
}

.circle-dropdown-trigger:focus {
    outline: none;
    box-shadow: 0 0 0 1px var(--primary-color);
}

.circle-dropdown-trigger.open {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.circle-dropdown-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.circle-dropdown-placeholder {
    color: var(--text-secondary);
}

.circle-dropdown-arrow {
    width: 18px;
    height: 18px;
    opacity: 0.6;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.circle-dropdown-trigger.open .circle-dropdown-arrow {
    transform: rotate(180deg);
}

.circle-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.circle-dropdown-menu.open {
    display: block;
}

.circle-dropdown-list {
    padding: 4px 0;
}

.circle-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.circle-dropdown-item:hover {
    background-color: var(--bg-hover);
}

.circle-dropdown-item.selected {
    background-color: var(--primary-color-alpha, rgba(37, 99, 235, 0.1));
}

.circle-dropdown-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-tertiary);
}

.circle-dropdown-item-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.circle-dropdown-item-icon .icon-placeholder {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
}

.circle-dropdown-item-info {
    flex: 1;
    min-width: 0;
}

.circle-dropdown-item-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.circle-dropdown-item-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Selected state icon in trigger */
.circle-dropdown-selected .circle-dropdown-item-icon {
    width: 28px;
    height: 28px;
}

.circle-dropdown-selected .circle-dropdown-item-icon .icon-placeholder {
    font-size: 12px;
}

.circle-dropdown-selected .circle-dropdown-item-name {
    font-weight: 500;
}

/* Hint text below circle/profile selector */
.form-hint {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 6px;
    padding-left: 12px;
    display: none;
}

.form-hint.visible {
    display: block;
}

.form-hint.profile-hint {
    color: var(--primary-color);
}

.thread-title-input {
    width: 100%;
    padding: 15px 12px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.thread-title-input:hover {
    border-color: var(--text-secondary);
}

.thread-title-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.thread-title-input::placeholder {
    color: var(--text-muted);
}

.char-count {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    margin-top: 4px;
}

.char-count.warning {
    color: #ff6b00;
}

.char-count.error {
    color: #ff4444;
}

.thread-content-textarea {
    width: 100%;
    min-height: 150px;
    padding: 15px 12px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.2s;
}

.thread-content-textarea:hover {
    border-color: var(--text-secondary);
}

.thread-content-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.thread-content-textarea::placeholder {
    color: var(--text-muted);
}

.thread-url-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.thread-url-input:hover {
    border-color: var(--text-secondary);
}

.thread-url-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.thread-url-input::placeholder {
    color: var(--text-muted);
}

/* Media Upload */
.media-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.media-upload-area:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-hover);
}

.media-upload-area.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(0, 121, 211, 0.1);
}

.upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    opacity: 0.5;
}

.upload-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.media-preview {
    margin-top: 16px;
    position: relative;
}

.media-preview img,
.media-preview video {
    max-width: 100%;
    border-radius: 4px;
}

.remove-media-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.remove-media-btn:hover {
    background-color: rgba(0, 0, 0, 0.9);
}

/* Poll Options */
.poll-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.poll-option-item {
    display: flex;
    gap: 8px;
}

.poll-option-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
}

.poll-option-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.remove-option-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.remove-option-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.add-option-btn {
    background: none;
    border: 1px dashed var(--border-color);
    border-radius: 4px;
    padding: 10px 12px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 8px;
    width: 100%;
    transition: all 0.2s;
}

.add-option-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.poll-duration-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.poll-duration-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Options Checkboxes */
.thread-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background-color: var(--bg-secondary);
    border-radius: 4px;
}

.option-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.option-checkbox label {
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
}

.option-help {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 26px;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.btn-cancel {
    padding: 8px 24px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background-color: var(--bg-hover);
}

.btn-post {
    padding: 8px 24px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 20px;
    color: white;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 1000.2s;
}

.btn-post:hover:not(:disabled) {
    background-color: var(--primary-dark);
}

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

/* Guidelines Sidebar */
.create-thread-sidebar {
    position: sticky;
    top: 80px;
}

.posting-guidelines {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 16px;
}

.guidelines-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    letter-spacing: 0.5px;
}

.guidelines-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.guidelines-list li {
    font-size: 13px;
    color: var(--text-primary);
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.guidelines-list li:last-child {
    border-bottom: none;
}

.guidelines-list li::before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
    margin-right: 0.5em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .create-thread-container {
        max-width: 100%;
        margin: 16px auto;
    }

    .post-type-tab {
        padding: 10px 8px;
        font-size: 13px;
    }

    .post-type-tab span {
        display: none;
    }

    .create-thread-sidebar {
        display: none;
    }
}
