/**
 * QRFix Support Panel Styles
 */

/* Reset and Base */
.qrfix-support-panel {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f2 100%);
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

.qrfix-support-panel * {
    box-sizing: border-box;
}

/* Login Section */
.support-login-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 40px);
}

.login-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #9333EA 0%, #7C3AED 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.login-icon svg {
    stroke: white !important;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px;
}

.login-header p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.2s;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    outline: none;
    border-color: #9333EA;
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

.remember-me label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 400;
}

.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #9333EA;
}

.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 20px;
}

.btn-login {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #9333EA 0%, #7C3AED 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.4);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.login-footer p {
    font-size: 13px;
    color: #94a3b8;
    margin: 0;
}

/* Access Denied */
.access-denied {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 40px);
    text-align: center;
    padding: 40px;
}

.access-denied-icon {
    margin-bottom: 24px;
}

.access-denied h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px;
}

.access-denied p {
    font-size: 16px;
    color: #64748b;
    margin: 0 0 8px;
}

.btn-logout,
.btn-logout-small {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #f1f5f9;
    color: #475569;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    margin-top: 20px;
}

.btn-logout:hover,
.btn-logout-small:hover {
    background: #e2e8f0;
    color: #ef4444;
}

/* Support Dashboard */
.support-dashboard {
    max-width: 1400px;
    margin: 0 auto;
}

.support-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 24px 32px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.header-left h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    padding: 8px 16px;
    background: #f3f4f6;
    border-radius: 8px;
}

.btn-logout-small {
    padding: 8px 16px;
    margin-top: 0;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    padding: 20px 24px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.open {
    background: #fef3c7;
    color: #d97706;
}

.stat-icon.in-progress {
    background: #dbeafe;
    color: #2563eb;
}

.stat-icon.resolved {
    background: #dcfce7;
    color: #16a34a;
}

.stat-icon.closed {
    background: #f3f4f6;
    color: #6b7280;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

/* Filters Row */
.filters-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    background: white;
    padding: 20px 24px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    min-width: 160px;
    transition: all 0.2s;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #9333EA;
}

.filter-group.search {
    flex: 1;
    min-width: 200px;
}

.filter-group.search input {
    width: 100%;
}

.btn-refresh {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #9333EA 0%, #7C3AED 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-refresh:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

/* Tickets Table */
.tickets-table-container {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.tickets-table {
    width: 100%;
    border-collapse: collapse;
}

.tickets-table th {
    background: #f8fafc;
    padding: 14px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e7eb;
}

.tickets-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: #374151;
}

.tickets-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.tickets-table tbody tr:hover {
    background: #f8fafc;
}

.tickets-table .loading-row {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.tickets-table .loading-row .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #9333EA;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.tickets-table .empty-row {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.ticket-number {
    font-family: monospace;
    font-size: 13px;
    color: #64748b;
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 4px;
}

.customer-info {
    line-height: 1.4;
}

.customer-info .name {
    font-weight: 600;
    color: #1e293b;
}

.customer-info .email {
    font-size: 12px;
    color: #64748b;
}

/* Priority Badges */
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.priority-badge.urgent {
    background: #fef2f2;
    color: #dc2626;
}

.priority-badge.high {
    background: #fff7ed;
    color: #ea580c;
}

.priority-badge.normal {
    background: #f0fdf4;
    color: #16a34a;
}

.priority-badge.low {
    background: #f8fafc;
    color: #64748b;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.open {
    background: #fef3c7;
    color: #d97706;
}

.status-badge.in_progress,
.status-badge.in-progress {
    background: #dbeafe;
    color: #2563eb;
}

.status-badge.resolved {
    background: #dcfce7;
    color: #16a34a;
}

.status-badge.closed {
    background: #f3f4f6;
    color: #6b7280;
}

/* Table Action Buttons */
.action-btn {
    padding: 6px 12px;
    background: #f3f4f6;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}

.action-btn:hover {
    background: #e5e7eb;
}

.action-btn.primary {
    background: linear-gradient(135deg, #9333EA 0%, #7C3AED 100%);
    color: white;
}

.action-btn.primary:hover {
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.3);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
    padding: 32px;
    z-index: 1;
}

.modal-content.large {
    max-width: 900px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
    transition: all 0.15s;
}

.modal-close:hover {
    background: #e5e7eb;
    color: #1e293b;
}

/* Ticket Detail in Modal */
.ticket-detail-header {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 20px;
    margin-bottom: 24px;
}

.ticket-detail-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px;
}

.ticket-meta-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #64748b;
}

.meta-item strong {
    color: #374151;
}

.ticket-description {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.ticket-description h4 {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ticket-description p {
    color: #374151;
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
}

/* Conversation */
.conversation-section {
    margin-bottom: 24px;
}

.conversation-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    margin: 0 0 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-item {
    background: #f8fafc;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.message-item.support {
    background: #f0fdf4;
    border-left: 3px solid #16a34a;
}

.message-item.internal {
    background: #fef3c7;
    border-left: 3px solid #d97706;
}

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.message-author {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
}

.message-date {
    font-size: 12px;
    color: #94a3b8;
}

.message-content {
    color: #374151;
    line-height: 1.6;
    white-space: pre-wrap;
}

.internal-badge {
    font-size: 11px;
    background: #fef3c7;
    color: #d97706;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

/* Reply Form */
.reply-section {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    margin-top: 24px;
}

.reply-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 12px;
}

.reply-section textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.reply-section textarea:focus {
    outline: none;
    border-color: #9333EA;
}

.reply-options {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
}

.reply-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #64748b;
    cursor: pointer;
}

.reply-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

.btn-send-reply {
    padding: 10px 24px;
    background: linear-gradient(135deg, #9333EA 0%, #7C3AED 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-send-reply:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

/* Status/Priority Update Row */
.update-row {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: #f1f5f9;
    border-radius: 12px;
    margin-top: 24px;
}

.update-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.update-group label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.update-group select {
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.update-group select:focus {
    outline: none;
    border-color: #9333EA;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select,
    .filter-group input {
        width: 100%;
    }

    .support-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .tickets-table {
        font-size: 13px;
    }

    .tickets-table th,
    .tickets-table td {
        padding: 10px;
    }
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    background: #1e293b;
    color: white;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.toast-notification.success {
    background: #16a34a;
}

.toast-notification.error {
    background: #dc2626;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}