/*
 * Custom UI Components - Batch 3.3
 * Add this to your static/css/components.css
 * Include in base.html: <link rel="stylesheet" href="{% static 'css/components.css' %}">
 */

/* ============================================
   CUSTOM DROPDOWN (replaces native select)
   ============================================ */

.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select {
    position: relative;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
}

.custom-select.open {
    border-color: #d4a373;
    border-radius: 8px 8px 0 0;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    min-height: 44px;
}

.custom-select-trigger .selected-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-select-trigger .selected-value .color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.custom-select-trigger .arrow {
    color: #9ca3af;
    transition: transform 0.2s;
}

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

.custom-select-options {
    position: absolute;
    top: 100%;
    left: -1px;
    right: -1px;
    background: #1f2937;
    border: 1px solid #d4a373;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

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

.custom-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.custom-option:hover {
    background: #374151;
}

.custom-option.selected {
    background: #374151;
}

.custom-option .color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.custom-option .option-text {
    flex: 1;
}

.custom-option .option-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #374151;
    color: #9ca3af;
}

.custom-option .checkmark {
    color: #d4a373;
    opacity: 0;
}

.custom-option.selected .checkmark {
    opacity: 1;
}

/* Group headers in dropdown */
.custom-option-group {
    padding: 8px 14px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-option-divider {
    height: 1px;
    background: #374151;
    margin: 4px 0;
}

/* ============================================
   ROLE BADGES
   ============================================ */

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.role-badge.owner {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.role-badge.manager {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.role-badge.developer {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.role-badge.admin {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.role-badge.moderator {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.role-badge.staff {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.role-badge.vip {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.role-badge.player {
    background: rgba(107, 114, 128, 0.15);
    color: #9ca3af;
    border: 1px solid rgba(107, 114, 128, 0.3);
}

/* ============================================
   TICKET MESSAGE STYLING
   ============================================ */

.message-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* User message - LEFT aligned, darker */
.message.user-message {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 12px;
    padding: 16px;
    margin-right: 48px;
    position: relative;
}

.message.user-message::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #6b7280;
    border-radius: 3px 0 0 3px;
}

/* Staff message - RIGHT aligned, accent color border */
.message.staff-message {
    background: #1a1f2e;
    border: 1px solid #2d3548;
    border-radius: 12px;
    padding: 16px;
    margin-left: 48px;
    position: relative;
}

.message.staff-message::before {
    content: '';
    position: absolute;
    right: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
}

/* Dynamic staff colors - set via inline style */
.message.staff-message.owner::before { background: #ef4444; }
.message.staff-message.manager::before { background: #3b82f6; }
.message.staff-message.developer::before { background: #8b5cf6; }
.message.staff-message.admin::before { background: #f97316; }
.message.staff-message.moderator::before { background: #22c55e; }
.message.staff-message.staff::before { background: #eab308; }

.message-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
}

.message-avatar.user {
    background: #6b7280;
}

/* Staff avatar colors */
.message-avatar.owner { background: #ef4444; }
.message-avatar.manager { background: #3b82f6; }
.message-avatar.developer { background: #8b5cf6; }
.message-avatar.admin { background: #f97316; }
.message-avatar.moderator { background: #22c55e; }
.message-avatar.staff { background: #eab308; }

.message-meta {
    flex: 1;
}

.message-author {
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-time {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.message-content {
    color: #e5e7eb;
    line-height: 1.6;
}

.message-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.message-action-btn {
    background: transparent;
    border: 1px solid #374151;
    color: #9ca3af;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}

.message-action-btn:hover {
    border-color: #d4a373;
    color: #d4a373;
}

/* Internal note styling */
.message.internal-note {
    background: #1c1917;
    border: 1px dashed #78716c;
    margin-left: 48px;
}

.message.internal-note::before {
    background: #78716c;
}

.internal-note-label {
    font-size: 11px;
    color: #a8a29e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================
   USER BADGES (no emojis)
   ============================================ */

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
}

.user-badge i {
    font-size: 10px;
}

/* ============================================
   QUICK ACTION BUTTONS
   ============================================ */

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}

.quick-action-btn:hover {
    background: #374151;
    border-color: #4b5563;
}

.quick-action-btn.active {
    background: #d4a37315;
    border-color: #d4a373;
    color: #d4a373;
}

.quick-action-btn.danger {
    color: #f87171;
}

.quick-action-btn.danger:hover {
    background: #ef444420;
    border-color: #ef4444;
}

.quick-action-btn i {
    width: 16px;
    text-align: center;
    color: #9ca3af;
}

.quick-action-btn:hover i,
.quick-action-btn.active i {
    color: inherit;
}

/* ============================================
   STATUS BADGES
   ============================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge.open {
    background: #22c55e20;
    color: #22c55e;
}

.status-badge.pending {
    background: #eab30820;
    color: #eab308;
}

.status-badge.replied {
    background: #3b82f620;
    color: #3b82f6;
}

.status-badge.closed {
    background: #6b728020;
    color: #9ca3af;
}

.status-badge.urgent {
    background: #ef444420;
    color: #ef4444;
    animation: pulse-urgent 2s infinite;
}

@keyframes pulse-urgent {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ============================================
   PRIORITY INDICATORS
   ============================================ */

.priority-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}

.priority-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.priority-indicator.low .dot { background: #22c55e; }
.priority-indicator.normal .dot { background: #3b82f6; }
.priority-indicator.high .dot { background: #f97316; }
.priority-indicator.urgent .dot { 
    background: #ef4444; 
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

/* ============================================
   SIDEBAR CARDS
   ============================================ */

.sidebar-card {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.sidebar-title {
    font-size: 13px;
    font-weight: 600;
    color: #d4a373;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #374151;
}

.sidebar-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}

.sidebar-item .label {
    color: #9ca3af;
}

.sidebar-item .value {
    color: #e5e7eb;
    font-weight: 500;
}

.sidebar-item .value a {
    color: #d4a373;
    text-decoration: none;
}

.sidebar-item .value a:hover {
    text-decoration: underline;
}
