/* =============== BASIC RESET & VARIABLES =============== */
:root {
    --primary-color: #2563eb;
    --success-color: #059669;
    --warning-color: #d97706;
    --error-color: #dc2626;
    --info-color: #0891b2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.details-box {
    font-family: "Inter var", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif;
}
.complaint-meta {
    display: none !important;
}
.details-box h1 {
    margin: 0px !important;
}
.modal-content {
    position: relative;
    overflow: hidden;
}

/* Ensure modal content stays above confetti */
.modal-header,
.modal-body {
    position: relative;
    z-index: 1001;
}

/* Confetti canvas */
.modal-content canvas {
    border-radius: 20px;
}
/* =============== COMPLAINTS UI STYLES =============== */
.complaints-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    background: var(--gray-50);
    border-radius: var(--border-radius-lg);
    margin-bottom: 40px;
}

.complaints-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 32px;
}

.complaints-tab {
    background: white;
    padding: 20px 16px;
    text-align: center;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.complaints-tab:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--gray-200);
}

.complaints-tab.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.complaints-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.complaint-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    cursor: pointer;
    border-left: 4px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

.complaint-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color));
}

.complaint-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.complaint-card.solved::before { background: linear-gradient(90deg, var(--success-color), #10b981); }
.complaint-card.rejected::before { background: linear-gradient(90deg, var(--error-color), #ef4444); }
.complaint-card.pending::before { background: linear-gradient(90deg, var(--warning-color), #f59e0b); }

.complaint-subject {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.complaint-amount {
    color: var(--error-color);
    font-weight: 700;
    font-size: 18px;
    margin: 8px 0;
}

.complaint-card-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 12px;
    background: var(--gray-100);
    color: var(--gray-700);
}

/* =============== COMPLAINT DETAILS STYLES =============== */
.details-box {
    max-width: 1000px;
    margin: 20px auto;
    background: white;
    padding: 0;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.header-container {
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: white;
    padding: 32px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.header-content h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
    color: white;
margin:0px !important;
}

.complaint-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.meta-label {
    opacity: 0.9;
    font-weight: 500;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.resolved { background: rgba(16, 185, 129, 0.2); color: #10b981; border: 1px solid #10b981; }
.status-badge.rejected { background: rgba(239, 68, 68, 0.2); color: #ef4444; border: 1px solid #ef4444; }
.status-badge.pending { background: rgba(245, 158, 11, 0.2); color: #f59e0b; border: 1px solid #f59e0b; }
.status-badge.opened { background: rgba(59, 130, 246, 0.2); color: #3b82f6; border: 1px solid #3b82f6; }

.continue-chat-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 14px 24px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.continue-chat-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Chat Box Styles */
.chat-box {
    padding: 0;
    background: var(--gray-50);
}

.chat-messages-container {
    max-height: 60vh;
    overflow-y: auto;
    padding: 24px;
    background: var(--gray-50);
}

.chat-messages-container::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-container::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 10px;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 10px;
}

.chat-messages-container::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Message Styles - IMPROVED DESIGN */
.msg-user, .msg-admin {
    padding: 16px 20px;
    border-radius: 18px;
    margin-bottom: 16px;
    max-width: 70%;
    word-wrap: break-word;
    line-height: 1.5;
    position: relative;
    animation: messageSlide 0.3s ease-out;
    box-shadow: var(--shadow-sm);
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.msg-user {
    background: white;
    border: 1px solid var(--gray-200);
    margin-right: auto;
    margin-left: 0;
    border-bottom-left-radius: 6px;
}

.msg-admin {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    margin-left: auto;
    margin-right: 0;
    border-bottom-right-radius: 6px;
    box-shadow: var(--shadow-md);
}

.msg-header {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 8px;
}

.msg-user .msg-header {
    color: var(--gray-600);
}

.msg-admin .msg-header {
    color: rgba(255, 255, 255, 0.9);
}

.msg-content {
    font-size: 15px;
    line-height: 1.5;
    margin: 8px 0;
}

.msg-user .msg-content {
    color: var(--gray-800);
}

.msg-admin .msg-content {
    color: white;
}

.msg-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 8px;
    text-align: right;
}

.msg-user .msg-time {
    color: var(--gray-500);
}

.msg-admin .msg-time {
    color: rgba(255, 255, 255, 0.8);
}

/* Complaint Info */
.complaint-info {
    background: linear-gradient(135deg, #fff7ed, #fed7aa);
    border: 1px solid #fdba74;
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 24px;
    border-left: 4px solid #f97316;
}

.info-item {
    margin: 8px 0;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.info-label {
    font-weight: 600;
    color: #9a3412;
    min-width: 80px;
    margin-right: 12px;
}

/* Loading States */
.loading-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Status Messages */
.no-chat {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
    font-style: italic;
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--border-radius);
    padding: 16px 20px;
    margin: 20px;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--border-radius);
    padding: 12px 16px;
    margin: 20px;
    color: #166534;
    font-size: 14px;
    border-left: 4px solid #22c55e;
}

/* Other Complaints Section */
.other-complaints-section {
    background: var(--gray-50);
    padding: 32px;
    border-top: 1px solid var(--gray-200);
}

.section-header {
    text-align: center;
    margin-bottom: 24px;
}

.section-header h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.section-header p {
    color: var(--gray-600);
    font-size: 14px;
}

.other-complaints-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.other-complaint-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    cursor: pointer;
    border-left: 4px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

.other-complaint-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.other-complaint-card.resolved::before { background: var(--success-color); }
.other-complaint-card.rejected::before { background: var(--error-color); }
.other-complaint-card.pending::before { background: var(--warning-color); }

.other-complaint-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.other-complaint-subject {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.other-complaint-amount {
    color: var(--error-color);
    font-weight: 700;
    font-size: 16px;
    margin: 8px 0;
}

.other-complaint-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-resolved {
    background: #dcfce7;
    color: #166534;
}

.status-rejected {
    background: #fee2e2;
    color: #991b1b;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

/* =============== MODAL STYLES - IMPROVED =============== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
    backdrop-filter: blur(8px);
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: var(--border-radius-xl);
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow-xl);
    animation: modalSlide 0.3s ease-out;
    overflow: hidden;
    font-family: "Inter var", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif;
}
.complaints-wrapper {
    font-family: "Inter var", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif;
}
@keyframes modalSlide {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.modal-icon {
    font-size: 24px;
    background: rgba(255, 255, 255, 0.2);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    flex: 1;
}

.close-modal {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: white;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 32px;
}

.modal-description {
    text-align: center;
    color: var(--gray-600);
    margin-bottom: 24px;
    font-size: 15px;
}

.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.user-id-input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.user-id-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.validate-btn, .send-message-btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.validate-btn:hover:not(:disabled), .send-message-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.validate-btn:disabled, .send-message-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-loader {
    display: none;
}

.api-response {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin: 16px 0;
    font-size: 14px;
    border-left: 4px solid transparent;
    display: none;
}

.api-response.show {
    display: block;
}

.api-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #22c55e;
}

.api-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #ef4444;
}

.chat-input-container {
    margin-top: 24px;
    display: none;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--gray-600);
}

.input-header small {
    color: var(--gray-500);
    font-size: 12px;
}

.chat-textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    line-height: 1.5;
}

.chat-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* =============== RESPONSIVE STYLES =============== */
@media (max-width: 1024px) {
    .complaints-list {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .header-container {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .complaint-meta {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .complaints-wrapper {
        padding: 16px;
    }
    
    .complaints-tabs {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .details-box {
        margin: 10px;
        border-radius: var(--border-radius-lg);
    }
    
    .header-container {
        padding: 24px 20px;
    }
    
    .header-content h2 {
        font-size: 24px;
    }
    
    .chat-messages-container {
        padding: 16px;
        max-height: 50vh;
    }
    
    .msg-user, .msg-admin {
        max-width: 85%;
        padding: 14px 16px;
    }
    
    .other-complaints-section {
        padding: 24px 20px;
    }
    
    .other-complaints-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .modal-body {
        padding: 24px 20px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .validate-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .complaints-wrapper {
        padding: 12px;
    }
    
    .header-content h2 {
        font-size: 20px;
    }
    
    .complaint-meta {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
    
    .chat-messages-container {
        padding: 12px;
        max-height: 45vh;
    }
    
    .msg-user, .msg-admin {
        max-width: 90%;
        padding: 12px 14px;
    }
    
    .other-complaints-section {
        padding: 20px 16px;
    }
    
    .modal-body {
        padding: 20px 16px;
    }
}
.attachment-section {
    margin-bottom: 10px;
    padding: 8px;
    border: 1px dashed #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.attachment-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.file-name {
    font-size: 12px;
    color: #666;
    flex-grow: 1;
}

.remove-file-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.msg-attachment {
    margin-top: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.attachment-image {
    max-width: 200px;
    max-height: 150px;
    border-radius: 4px;
}

.attachment-file {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #007bff;
    text-decoration: none;
}
/* Chat Specific Message Actions */
.chat-msg-actions {
    position: relative;
    display: inline-block;
}

.chat-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #666;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    line-height: 1;
}

.chat-menu-btn:hover {
    background: #f0f0f0;
}

.chat-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 120px;
    z-index: 10000;
    padding: 4px 0;
}

.chat-menu-dropdown.active {
    display: block;
}

.chat-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    gap: 8px;
    transition: background 0.2s;
}

.chat-menu-item:hover {
    background: #f5f5f5;
}

.chat-delete-item {
    color: #d32f2f;
}

.chat-delete-item:hover {
    background: #ffebee;
}
/* Three Dots Menu CSS - Unique Classes */
.msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.msg-sender-info {
    flex: 1;
}

.chat-msg-actions {
    position: relative;
    display: inline-block;
}

.chat-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #666;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
    line-height: 1;
}

.chat-menu-btn:hover {
    background: #f0f0f0;
}

.chat-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 100px;
    z-index: 1000;
}

.chat-menu-dropdown.active {
    display: block;
}

.chat-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 6px 10px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    gap: 6px;
}

.chat-menu-item:hover {
    background: #f5f5f5;
}

.chat-delete-item {
    color: #d32f2f;
}

.chat-delete-item:hover {
    background: #ffebee;
}
/* Utility Classes */
.text-center { text-align: center; }
.mb-4 { margin-bottom: 16px; }
.mt-4 { margin-top: 16px; }
.hidden { display: none; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 16px; }