/**
 * TFM Cloud Services - Support Portal Frontend Styles
 * For WooCommerce My Account Support Tab
 */

/* ========================================
   Support Portal Header
======================================== */

.tfmcs-support-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
}

.tfmcs-support-header h2 {
    margin: 0;
}

.tfmcs-support-actions {
    display: flex;
    gap: 10px;
}

/* ========================================
   Ticket List
======================================== */

.tfmcs-ticket-list-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
}

.tfmcs-ticket-list-filters label {
    font-weight: 600;
    margin-right: 5px;
}

.tfmcs-tickets-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tfmcs-ticket-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 15px;
    transition: box-shadow 0.2s ease;
}

.tfmcs-ticket-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tfmcs-ticket-item.unread {
    border-left: 4px solid #2271b1;
}

.tfmcs-ticket-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.tfmcs-ticket-item-title {
    flex: 1;
}

.tfmcs-ticket-item-title a {
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    color: #1e1e1e;
}

.tfmcs-ticket-item-title a:hover {
    color: #2271b1;
}

.tfmcs-ticket-item-number {
    font-size: 13px;
    color: #666;
    font-family: monospace;
}

.tfmcs-ticket-item-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #666;
}

.tfmcs-ticket-item-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Status badges */
.tfmcs-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Priority */
.tfmcs-priority-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.tfmcs-priority-low {
    background: #e8f5e9;
    color: #2e7d32;
}

.tfmcs-priority-normal {
    background: #e3f2fd;
    color: #1565c0;
}

.tfmcs-priority-high {
    background: #fff3e0;
    color: #e65100;
}

.tfmcs-priority-urgent {
    background: #ffebee;
    color: #c62828;
}

/* Empty state */
.tfmcs-no-tickets {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 4px;
}

.tfmcs-no-tickets p {
    color: #666;
    margin-bottom: 20px;
}

/* ========================================
   New Ticket Form
======================================== */

.tfmcs-new-ticket-form {
    max-width: 700px;
}

.tfmcs-form-row {
    margin-bottom: 20px;
}

.tfmcs-form-row label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.tfmcs-form-row .required {
    color: #d63638;
}

.tfmcs-form-row input[type="text"],
.tfmcs-form-row input[type="email"],
.tfmcs-form-row input[type="number"],
.tfmcs-form-row input[type="date"],
.tfmcs-form-row textarea,
.tfmcs-form-row select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.tfmcs-form-row textarea {
    min-height: 150px;
    resize: vertical;
}

.tfmcs-form-row input:focus,
.tfmcs-form-row textarea:focus,
.tfmcs-form-row select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.tfmcs-form-description {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

/* Checkbox and radio groups */
.tfmcs-checkbox-group,
.tfmcs-radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tfmcs-checkbox-group label,
.tfmcs-radio-group label {
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* File upload */
.tfmcs-file-upload {
    border: 2px dashed #ddd;
    border-radius: 4px;
    padding: 30px;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.tfmcs-file-upload:hover,
.tfmcs-file-upload.dragover {
    border-color: #2271b1;
    background: #f0f6fc;
}

.tfmcs-file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.tfmcs-file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.tfmcs-file-upload-icon {
    font-size: 32px;
    color: #999;
}

.tfmcs-file-list {
    list-style: none;
    padding: 0;
    margin: 15px 0 0;
}

.tfmcs-file-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    margin-bottom: 5px;
}

.tfmcs-file-list .file-name {
    flex: 1;
}

.tfmcs-file-list .file-size {
    font-size: 12px;
    color: #666;
}

.tfmcs-file-list .remove-file {
    color: #d63638;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

/* Submit button */
.tfmcs-submit-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.tfmcs-submit-btn:hover {
    background: #135e96;
}

.tfmcs-submit-btn:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.tfmcs-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ========================================
   Ticket Detail View
======================================== */

.tfmcs-ticket-detail {
    max-width: 900px;
}

.tfmcs-ticket-detail-header {
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 25px;
    margin-bottom: 25px;
}

.tfmcs-ticket-detail-title {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.tfmcs-ticket-detail-title h2 {
    margin: 0;
    flex: 1;
}

.tfmcs-ticket-detail-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 14px;
    color: #666;
}

.tfmcs-ticket-detail-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Description */
.tfmcs-ticket-description-section {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 25px;
    margin-bottom: 25px;
}

.tfmcs-ticket-description-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e5e5;
}

/* Thread/Replies */
.tfmcs-ticket-thread-section {
    margin-bottom: 25px;
}

.tfmcs-ticket-thread-section h3 {
    margin-bottom: 20px;
}

.tfmcs-reply-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 15px;
}

.tfmcs-reply-item.from-staff {
    background: #fef8e6;
    border-left: 4px solid #dba617;
}

.tfmcs-reply-item.from-user {
    border-left: 4px solid #2271b1;
}

.tfmcs-reply-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e5e5;
}

.tfmcs-reply-author {
    font-weight: 600;
}

.tfmcs-reply-author .staff-badge {
    display: inline-block;
    padding: 2px 6px;
    background: #dba617;
    color: #fff;
    font-size: 10px;
    border-radius: 3px;
    margin-left: 8px;
    font-weight: normal;
}

.tfmcs-reply-date {
    font-size: 13px;
    color: #666;
}

.tfmcs-reply-content {
    line-height: 1.7;
}

/* Reply form */
.tfmcs-reply-form-section {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 25px;
}

.tfmcs-reply-form-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.tfmcs-reply-form-section textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
    resize: vertical;
}

.tfmcs-reply-form-section textarea:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

/* Attachments */
.tfmcs-attachments-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e5e5;
}

.tfmcs-attachments-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 14px;
}

.tfmcs-attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    background: #f0f0f0;
    border-radius: 3px;
    text-decoration: none;
    color: #1e1e1e;
    font-size: 13px;
    margin-right: 8px;
    margin-bottom: 5px;
}

.tfmcs-attachment-link:hover {
    background: #e0e0e0;
}

.tfmcs-attachment-size {
    font-size: 11px;
    color: #666;
}

/* ========================================
   Messages/Notices
======================================== */

.tfmcs-notice {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.tfmcs-notice-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.tfmcs-notice-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.tfmcs-notice-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* ========================================
   Loading State
======================================== */

.tfmcs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
}

.tfmcs-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e5e5e5;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: tfmcs-spin 0.8s linear infinite;
    margin-right: 10px;
}

@keyframes tfmcs-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   Responsive
======================================== */

@media screen and (max-width: 768px) {
    .tfmcs-support-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .tfmcs-ticket-list-filters {
        flex-direction: column;
    }

    .tfmcs-ticket-item-header {
        flex-direction: column;
        gap: 10px;
    }

    .tfmcs-ticket-item-meta {
        flex-direction: column;
        gap: 8px;
    }

    .tfmcs-ticket-detail-title {
        flex-direction: column;
        align-items: flex-start;
    }

    .tfmcs-ticket-detail-info {
        flex-direction: column;
        gap: 10px;
    }

    .tfmcs-reply-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ========================================
   Accessibility
======================================== */

/* Focus visible indicators */
.tfmcs-ticket-item-title a:focus,
.tfmcs-attachment-link:focus,
button:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Skip link */
.tfmcs-skip-link {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: 8px 16px;
    background: #1e1e1e;
    color: #fff;
    text-decoration: none;
}

.tfmcs-skip-link:focus {
    left: 10px;
    top: 10px;
}

/* Screen reader text */
.tfmcs-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Live region for announcements */
.tfmcs-live-region {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ========================================
   Markdown Content Field
======================================== */

.tfmcs-field-markdown {
    margin-bottom: 25px;
}

.tfmcs-field-markdown > label {
    /* Hide the label for markdown fields since it's display-only content */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tfmcs-markdown-content {
    background: #f8f9fa;
    border-left: 4px solid #2271b1;
    padding: 20px;
    border-radius: 0 4px 4px 0;
    line-height: 1.7;
}

.tfmcs-markdown-content h2 {
    font-size: 1.5em;
    margin: 0 0 15px 0;
    color: #1e1e1e;
}

.tfmcs-markdown-content h3 {
    font-size: 1.25em;
    margin: 0 0 12px 0;
    color: #1e1e1e;
}

.tfmcs-markdown-content h4 {
    font-size: 1.1em;
    margin: 0 0 10px 0;
    color: #1e1e1e;
}

.tfmcs-markdown-content p {
    margin: 0 0 15px 0;
}

.tfmcs-markdown-content p:last-child {
    margin-bottom: 0;
}

.tfmcs-markdown-content ul,
.tfmcs-markdown-content ol {
    margin: 0 0 15px 20px;
    padding: 0;
}

.tfmcs-markdown-content li {
    margin-bottom: 5px;
}

.tfmcs-markdown-content a {
    color: #2271b1;
    text-decoration: underline;
}

.tfmcs-markdown-content a:hover {
    color: #135e96;
}

.tfmcs-markdown-content hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 20px 0;
}

.tfmcs-markdown-content strong {
    font-weight: 600;
}

.tfmcs-markdown-content em {
    font-style: italic;
}

/* ========================================
   Conditional Logic & Field Visibility
======================================== */

.tfmcs-hidden-by-logic,
.tfmcs-hidden-by-field-logic {
    display: none !important;
}

.tfmcs-field-required label::after {
    content: " *";
    color: #d63638;
}

/* ========================================
   Attachment Behavior States
======================================== */

.tfmcs-attachment-guidance {
    margin-top: 10px;
    padding: 12px 15px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
}

.tfmcs-guidance-required {
    background: #fcecec;
    border: 1px solid #d63638;
    color: #8a1c1c;
}

.tfmcs-guidance-recommended {
    background: #fff8e5;
    border: 1px solid #dba617;
    color: #6b4e00;
}

.tfmcs-guidance-optional {
    background: #f0f6fc;
    border: 1px solid #72aee6;
    color: #1e4d7b;
}

.tfmcs-attachments-required .tfmcs-file-upload {
    border-color: #d63638;
}

.tfmcs-attachments-recommended .tfmcs-file-upload {
    border-color: #dba617;
}

.tfmcs-attachments-hidden {
    display: none !important;
}
