/* Customer support tickets — shared layout, buttons, uploads */

.ticket-pages .btn-login,
.ticket-pages .ticket-btn--primary {
    margin-top: 0;
    background: var(--gradient-accent);
    border: none;
    border-radius: 8px;
    padding: 0.5625rem 1.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.4;
    color: #fff;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(77, 106, 146, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 40px;
}

.ticket-pages .btn-login:hover:not(:disabled),
.ticket-pages .ticket-btn--primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(77, 106, 146, 0.28);
    color: #fff;
}

.ticket-pages .btn-login:disabled,
.ticket-pages .ticket-btn--primary:disabled,
.ticket-pages .btn-outline-secondary:disabled,
.ticket-pages .ticket-btn--outline:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ticket-pages .btn-outline-secondary,
.ticket-pages .ticket-btn--outline {
    margin-top: 0;
    border-radius: 8px;
    padding: 0.5625rem 1.25rem;
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.4;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid #cbd5e1;
    color: #475569;
    background: #fff;
    transition: all 0.2s ease;
}

.ticket-pages .btn-outline-secondary:hover:not(:disabled),
.ticket-pages .ticket-btn--outline:hover:not(:disabled) {
    border-color: var(--accent-blue, #4d6a92);
    color: var(--accent-blue, #4d6a92);
    background: #f8fafc;
}

.ticket-pages .ticket-btn--sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    min-height: 34px;
    border-radius: 6px;
}

.ticket-pages .ticket-page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
}

.ticket-pages .ticket-form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.625rem;
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid #e2e8f0;
}

/* Priority selector */
.ticket-priority-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ticket-priority-option {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    margin: 0;
    min-height: 42px;
}

.ticket-priority-option:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.ticket-priority-option--active {
    border-color: var(--priority-color, #3b82f6);
    background: color-mix(in srgb, var(--priority-color, #3b82f6) 8%, white);
    color: #1e293b;
}

.ticket-priority-option__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ticket-priority-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Upload zone */
.ticket-upload-zone {
    position: relative;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 1.5rem 1.25rem;
    text-align: center;
    background: #f8fafc;
    transition: border-color 0.2s, background 0.2s, opacity 0.2s;
    cursor: pointer;
}

.ticket-upload-zone--compact {
    padding: 1rem;
}

.ticket-upload-zone:hover:not(.ticket-upload-zone--disabled),
.ticket-upload-zone--active:not(.ticket-upload-zone--disabled) {
    border-color: #3b82f6;
    background: #eff6ff;
}

.ticket-upload-zone--disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.ticket-upload-zone__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.ticket-upload-zone--disabled .ticket-upload-zone__input {
    cursor: not-allowed;
}

.ticket-upload-zone__icon {
    font-size: 1.75rem;
    color: #64748b;
    margin-bottom: 0.35rem;
}

.ticket-upload-zone--compact .ticket-upload-zone__icon {
    font-size: 1.35rem;
    margin-bottom: 0.2rem;
}

.ticket-upload-zone--active .ticket-upload-zone__icon,
.ticket-upload-zone:hover:not(.ticket-upload-zone--disabled) .ticket-upload-zone__icon {
    color: #2563eb;
}

.ticket-upload-zone__title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #334155;
    margin-bottom: 0.15rem;
}

.ticket-upload-zone__hint {
    font-size: 0.8125rem;
    color: #64748b;
    margin-bottom: 0;
}

.ticket-upload-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    margin-top: 0.65rem;
    font-size: 0.8125rem;
    color: #64748b;
}

.ticket-upload-loading {
    display: flex;
    align-items: center;
    margin-top: 0.65rem;
    padding: 0.5rem 0.75rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-size: 0.8125rem;
    color: #1d4ed8;
    font-weight: 500;
}

.ticket-file-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.ticket-file-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.ticket-file-item__icon {
    color: #3b82f6;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.ticket-file-item__name {
    flex: 1;
    font-size: 0.8125rem;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-file-item__size {
    font-size: 0.75rem;
    color: #94a3b8;
    flex-shrink: 0;
}

.ticket-file-item__remove {
    border: none;
    background: #f1f5f9;
    color: #64748b;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}

.ticket-file-item__remove:hover:not(:disabled) {
    background: #fee2e2;
    color: #dc2626;
}

.ticket-file-item__remove:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Create page */
.ticket-create-page .ticket-create-back {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.ticket-form-card .card-header-section {
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    padding: 1rem 1.25rem;
    background: var(--primary-light);
}

.ticket-message-field {
    resize: vertical;
    min-height: 160px;
    line-height: 1.6;
    font-size: 0.9375rem;
}

.ticket-help-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ticket-help-list li {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
}

.ticket-help-list__num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #eff6ff;
    color: #2563eb;
    font-weight: 700;
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ticket-help-note {
    padding: 0.85rem 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #166534;
}

/* Detail page chat */
.ticket-chat-card .card-body-section {
    display: flex;
    flex-direction: column;
}

.ticket-chat-thread {
    padding: 1.25rem 1.5rem;
    max-height: 55vh;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-bubble {
    max-width: 78%;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chat-bubble--admin {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.chat-bubble--customer {
    align-self: flex-end;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-bottom-right-radius: 4px;
}

.chat-bubble__header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.5rem;
}

.chat-bubble__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.chat-bubble__avatar--admin {
    background: #1e40af;
    color: #fff;
}

.chat-bubble__avatar--customer {
    background: #2563eb;
    color: #fff;
}

.chat-bubble__sender {
    display: block;
    font-size: 0.9rem;
    line-height: 1.2;
}

.chat-bubble__time {
    color: #64748b;
    font-size: 0.75rem;
}

.chat-bubble__body {
    font-size: 0.9375rem;
    line-height: 1.55;
    color: #1e293b;
    word-break: break-word;
}

.chat-bubble__attachments {
    margin-top: 0.65rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.chat-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #334155;
    text-decoration: none;
}

.chat-attachment:hover {
    background: #fff;
    color: #1e40af;
}

.ticket-reply-panel {
    border-top: 1px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
    background: #fff;
}

.ticket-meta-bar .priority-badge,
.ticket-meta-bar .status-badge,
.ticket-pages .dashboard-card .priority-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
}

@media (max-width: 768px) {
    .ticket-create-page .ticket-create-back {
        position: static;
        transform: none;
        display: flex;
        width: 100%;
        margin-top: 1rem;
        justify-content: center;
    }

    .ticket-form-actions,
    .ticket-page-actions {
        flex-direction: column;
        width: 100%;
    }

    .ticket-form-actions .btn,
    .ticket-form-actions a,
    .ticket-page-actions .btn,
    .ticket-page-actions a {
        width: 100%;
    }

    .ticket-priority-group {
        flex-direction: column;
    }

    .ticket-priority-option {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .chat-bubble {
        max-width: 92%;
    }
}
