/* MetaHuman Helpdesk - Frontend Styles */

.mhd-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Form Container */
.mhd-form-container {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
}

.mhd-form-container h2 {
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 24px;
    color: #1a1a1a;
}

/* Fields */
.mhd-field {
    margin-bottom: 20px;
}

.mhd-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.mhd-field .required {
    color: #dc3545;
}

.mhd-field input[type="text"],
.mhd-field input[type="email"],
.mhd-field input[type="password"],
.mhd-field select,
.mhd-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.mhd-field input:focus,
.mhd-field select:focus,
.mhd-field textarea:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.15);
}

.mhd-help-text {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

/* File Upload */
.mhd-file-upload {
    border: 2px dashed #ccc;
    border-radius: 6px;
    padding: 20px;
    text-align: center;
    transition: border-color 0.2s;
}

.mhd-file-upload:hover {
    border-color: #0073aa;
}

#mhd-file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

#mhd-file-preview .mhd-preview-item {
    background: #f5f5f5;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

#mhd-file-preview .mhd-preview-remove {
    cursor: pointer;
    color: #dc3545;
    font-weight: bold;
}

/* Buttons */
.mhd-btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

.mhd-btn:active {
    transform: scale(0.98);
}

.mhd-btn-primary {
    background: #0073aa;
    color: #fff;
}

.mhd-btn-primary:hover {
    background: #005a87;
    color: #fff;
}

.mhd-btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.mhd-btn-secondary:hover {
    background: #ccc;
}

.mhd-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Messages */
#mhd-form-messages,
#mhd-reply-messages,
#mhd-register-messages {
    margin-bottom: 15px;
}

.mhd-alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

.mhd-alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.mhd-alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Tickets Table */
.mhd-tickets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.mhd-tickets-header h2 {
    margin: 0;
}

.mhd-tickets-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.mhd-tickets-table th {
    background: #f8f9fa;
    padding: 12px 14px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
}

.mhd-tickets-table td {
    padding: 12px 14px;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}

.mhd-tickets-table tr:hover {
    background: #f8f9fa;
}

.mhd-tickets-table a {
    color: #0073aa;
    text-decoration: none;
}

.mhd-tickets-table a:hover {
    text-decoration: underline;
}

/* Status Badges */
.mhd-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.mhd-status-open { background: #cce5ff; color: #004085; }
.mhd-status-in-progress { background: #fff3cd; color: #856404; }
.mhd-status-awaiting-reply { background: #fce4ec; color: #c62828; }
.mhd-status-resolved { background: #d4edda; color: #155724; }
.mhd-status-closed { background: #e2e3e5; color: #383d41; }

/* Priority Badges */
.mhd-priority-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.mhd-priority-low { background: #d4edda; color: #155724; }
.mhd-priority-normal { background: #cce5ff; color: #004085; }
.mhd-priority-high { background: #fff3cd; color: #856404; }
.mhd-priority-urgent { background: #f8d7da; color: #721c24; }

/* Single Ticket View */
.mhd-ticket-header {
    margin-bottom: 20px;
}

.mhd-back-link {
    color: #0073aa;
    text-decoration: none;
    font-size: 14px;
}

.mhd-ticket-header h2 {
    margin: 10px 0 0;
    font-size: 22px;
}

.mhd-ticket-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #555;
}

.mhd-staff-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 6px;
    margin-bottom: 20px;
}

.mhd-staff-controls select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Messages / Conversation Thread */
.mhd-ticket-body {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.mhd-message {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.mhd-message-customer {
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
}

.mhd-message-staff {
    background: #fff8e1;
    border-left: 4px solid #ff9800;
}

.mhd-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #555;
}

.mhd-message-header strong {
    color: #1a1a1a;
    font-size: 14px;
}

.mhd-badge-staff {
    background: #ff9800;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.mhd-message-date {
    margin-left: auto;
    font-size: 12px;
    color: #999;
}

.mhd-message-content {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.mhd-message-attachments {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.mhd-attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.mhd-attachment-item img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.mhd-file-link {
    display: inline-block;
    padding: 6px 12px;
    background: #e8e8e8;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
}

/* Reply Form */
.mhd-reply-form {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid #e0e0e0;
}

.mhd-reply-form h3 {
    margin-top: 0;
    margin-bottom: 16px;
}

.mhd-closed-notice {
    margin-top: 20px;
    padding: 16px;
    background: #e2e3e5;
    border-radius: 6px;
    text-align: center;
    color: #383d41;
}

/* Auth Forms */
.mhd-auth-container {
    max-width: 480px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.mhd-auth-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
}

.mhd-auth-tab {
    flex: 1;
    padding: 14px;
    text-align: center;
    background: #f8f9fa;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: #555;
    transition: background 0.2s;
}

.mhd-auth-tab.active {
    background: #fff;
    color: #0073aa;
    border-bottom: 2px solid #0073aa;
    margin-bottom: -2px;
}

.mhd-auth-panel {
    display: none;
    padding: 30px;
}

.mhd-auth-panel.active {
    display: block;
}

.mhd-auth-panel h3 {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
}

.mhd-forgot-password {
    text-align: center;
    margin-top: 12px;
}

/* Empty State */
.mhd-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.mhd-empty-state p {
    font-size: 16px;
    color: #888;
    margin-bottom: 20px;
}

/* Pagination */
.mhd-pagination {
    margin-top: 20px;
    text-align: center;
}

.mhd-pagination .page-numbers {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 2px;
    border-radius: 4px;
    text-decoration: none;
    color: #0073aa;
    border: 1px solid #e0e0e0;
}

.mhd-pagination .page-numbers.current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* Responsive */
@media (max-width: 768px) {
    .mhd-wrap {
        padding: 10px;
    }

    .mhd-tickets-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .mhd-tickets-table {
        font-size: 13px;
    }

    .mhd-tickets-table th,
    .mhd-tickets-table td {
        padding: 8px 6px;
    }

    .mhd-ticket-meta-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .mhd-staff-controls {
        flex-direction: column;
        align-items: flex-start;
    }
}
