/* ========================================
   NewChat.css - Modal para criar nova conversa
   ======================================== */

/* Modal Overlay */
.new-chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.new-chat-modal.show {
    opacity: 1;
    visibility: visible;
}

/* Modal Content */
.new-chat-modal-content {
    background: var(--app-bg-secondary);
    border-radius: 16px;
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.new-chat-modal.show .new-chat-modal-content {
    transform: translateY(0);
}

/* Header */
.new-chat-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--app-border-color);
}

.new-chat-modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--app-text-primary);
    margin: 0;
}

.new-chat-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--app-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.new-chat-modal-close:hover {
    background: var(--app-bg-tertiary);
    color: var(--app-text-primary);
}

.new-chat-modal-close svg {
    width: 18px;
    height: 18px;
}

/* Controls */
.new-chat-controls {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid var(--app-border-color);
}

/* Search */
.new-chat-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--app-bg-tertiary);
    border-radius: 10px;
    padding: 0 12px;
    height: 38px;
}

.new-chat-search-box svg {
    width: 16px;
    height: 16px;
    color: var(--app-text-secondary);
    flex-shrink: 0;
}

.new-chat-search-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--app-text-primary);
    font-size: 0.9rem;
    outline: none;
}

.new-chat-search-input::placeholder {
    color: var(--app-text-secondary);
}

/* Filters */
.new-chat-filters {
    display: flex;
    gap: 8px;
}

.new-chat-select {
    flex: 1;
    height: 36px;
    border: 1px solid var(--app-border-color);
    border-radius: 8px;
    background: var(--app-bg-tertiary);
    color: var(--app-text-primary);
    font-size: 0.85rem;
    padding: 0 10px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.new-chat-select:focus {
    border-color: var(--app-primary-color);
}

/* Sort */
.new-chat-sort {
    display: flex;
    gap: 6px;
}

.new-chat-sort-btn {
    flex: 1;
    height: 32px;
    border: 1px solid var(--app-border-color);
    border-radius: 8px;
    background: transparent;
    color: var(--app-text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.new-chat-sort-btn:hover {
    background: var(--app-bg-tertiary);
}

.new-chat-sort-btn.active {
    background: var(--app-primary-color);
    color: white;
    border-color: var(--app-primary-color);
}

.sort-arrow {
    font-size: 0.75rem;
}

/* Selected Bar */
.new-chat-selected-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    background: var(--app-bg-tertiary);
    border-bottom: 1px solid var(--app-border-color);
    font-size: 0.82rem;
    color: var(--app-text-secondary);
    gap: 10px;
}

.new-chat-selected-bar span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex: 1;
}

.new-chat-clear-btn {
    border: none;
    background: transparent;
    color: var(--app-primary-color);
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.new-chat-clear-btn:hover {
    background: var(--app-bg-secondary);
}

/* Person List */
.new-chat-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 200px;
    max-height: 40vh;
}

.new-chat-list::-webkit-scrollbar {
    width: 6px;
}

.new-chat-list::-webkit-scrollbar-track {
    background: transparent;
}

.new-chat-list::-webkit-scrollbar-thumb {
    background: var(--app-border-color);
    border-radius: 3px;
}

.new-chat-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--app-text-secondary);
    font-size: 0.9rem;
}

/* Person Item */
.new-chat-person {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 20px;
    cursor: pointer;
    transition: background 0.15s ease;
    position: relative;
}

.new-chat-person:hover {
    background: var(--app-bg-tertiary);
}

.new-chat-person.selected {
    background: color-mix(in srgb, var(--app-primary-color) 10%, transparent);
}

.new-chat-person.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Checkbox */
.new-chat-person-check {
    flex-shrink: 0;
}

.new-chat-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--app-border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: transparent;
}

.new-chat-checkbox.checked {
    background: var(--app-primary-color);
    border-color: var(--app-primary-color);
}

.new-chat-checkbox.checked svg {
    width: 14px;
    height: 14px;
    color: white;
}

/* Avatar */
.new-chat-person-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background: var(--app-bg-tertiary);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--app-text-secondary);
}

.new-chat-person-avatar img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.new-chat-person-avatar svg {
    width: 24px;
    height: 24px;
}

/* Info */
.new-chat-person-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.new-chat-person-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--app-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.new-chat-person-details {
    font-size: 0.78rem;
    color: var(--app-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.new-chat-person-more-btn {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--app-text-primary);
    padding: 0;
    cursor: pointer;
}

.new-chat-person-more-btn svg {
    width: 16px;
    height: 16px;
}

.new-chat-person-more-btn:hover {
    background: color-mix(in srgb, var(--app-primary-color) 12%, transparent);
}



/* Sex Badge */
.new-chat-person-sex {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    vertical-align: middle;
}

.new-chat-person-sex svg {
    width: 13px;
    height: 13px;
}

.new-chat-person-sex.male {
    color: #3b82f6;
}

.new-chat-person-sex.female {
    color: #ec4899;
}

/* Footer */
.new-chat-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--app-border-color);
}

.new-chat-group-name-wrapper {
    margin-bottom: 10px;
}

.new-chat-group-input {
    width: 100%;
    height: 38px;
    border: 1px solid var(--app-border-color);
    border-radius: 8px;
    background: var(--app-bg-tertiary);
    color: var(--app-text-primary);
    font-size: 0.9rem;
    padding: 0 12px;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.new-chat-group-input:focus {
    border-color: var(--app-primary-color);
}

.new-chat-group-input::placeholder {
    color: var(--app-text-secondary);
}

.new-chat-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.new-chat-btn {
    height: 38px;
    padding: 0 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.new-chat-btn.secondary {
    background: var(--app-bg-tertiary);
    color: var(--app-text-secondary);
}

.new-chat-btn.secondary:hover {
    background: var(--app-border-color);
    color: var(--app-text-primary);
}

.new-chat-btn.primary {
    background: var(--app-primary-color);
    color: white;
}

.new-chat-btn.primary:hover:not(:disabled) {
    filter: brightness(1.1);
}

.new-chat-btn.primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Empty state for chats */
.chats-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--app-text-secondary);
    gap: 12px;
}

.chats-empty-icon {
    opacity: 0.3;
}

.chats-empty-icon svg {
    width: 48px;
    height: 48px;
}

.chats-empty p {
    font-size: 0.9rem;
    margin: 0;
}

/* Responsive */
@media (max-width: 600px) {
    .new-chat-modal-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 12px;
    }

    .new-chat-filters {
        flex-direction: column;
    }
}
