/* Support Ticket System - Frontend Styles v2.0 */

/* Alignment Classes */
.sts-align-center {
    margin-left: auto;
    margin-right: auto;
}

.sts-align-left {
    margin-left: 0;
    margin-right: auto;
}

.sts-align-right {
    margin-left: auto;
    margin-right: 0;
}

.sts-ticket-form-wrapper {
    max-width: 560px;
}

/* Form Title & Intro */
.sts-form-title {
    margin: 0 0 12px 0;
    color: #212121;
    font-size: 20px;
    font-weight: 600;
}

.sts-intro-text {
    margin-bottom: 20px;
    padding: 16px;
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    border-radius: 0 6px 6px 0;
    color: #424242;
    font-size: 14px;
    line-height: 1.6;
}

.sts-intro-text p:last-child {
    margin-bottom: 0;
}

.sts-intro-text a {
    color: #1976d2;
}

.sts-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.sts-form-row {
    margin-bottom: 14px;
}

.sts-form-row:last-child {
    margin-bottom: 0;
}

.sts-form-row-half {
    display: flex;
    gap: 14px;
}

.sts-form-col {
    flex: 1;
}

.sts-form label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 13px;
    color: #212121;
}

.sts-form label .required {
    color: #d32f2f;
}

.sts-form input[type="text"],
.sts-form input[type="email"],
.sts-form select,
.sts-form textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.sts-form input[type="text"]:focus,
.sts-form input[type="email"]:focus,
.sts-form select:focus,
.sts-form textarea:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.15);
}

.sts-form input[readonly] {
    background: #eceff1;
    cursor: not-allowed;
}

.sts-form textarea {
    resize: vertical;
    min-height: 100px;
}

/* File Upload Area */
.sts-file-upload-area {
    position: relative;
    border: 2px dashed #ccc;
    border-radius: 6px;
    padding: 18px;
    text-align: center;
    background: #fff;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.sts-file-upload-area:hover,
.sts-file-upload-area.dragover {
    border-color: #2196f3;
    background: #e3f2fd;
}

.sts-file-upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.sts-upload-placeholder {
    color: #666;
}

.sts-upload-placeholder .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #2196f3;
    margin-bottom: 6px;
}

.sts-upload-placeholder p {
    margin: 6px 0 4px;
    font-size: 13px;
}

.sts-upload-placeholder span {
    color: #2196f3;
    text-decoration: underline;
}

.sts-upload-placeholder small {
    color: #999;
    font-size: 11px;
}

.sts-file-upload-small {
    padding: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sts-file-upload-small .sts-upload-placeholder {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sts-file-upload-small .sts-upload-placeholder .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    margin: 0;
}

.sts-file-list {
    margin-top: 10px;
    text-align: left;
}

.sts-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #f5f5f5;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 12px;
}

.sts-file-item .dashicons {
    color: #666;
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.sts-file-item .file-name {
    flex: 1;
}

.sts-file-item .file-size {
    color: #999;
}

.sts-file-item .remove-file {
    color: #d32f2f;
    cursor: pointer;
    padding: 2px;
}

.sts-file-item .remove-file:hover {
    color: #b71c1c;
}

/* Submit Button */
.sts-submit-btn {
    display: inline-block;
    padding: 10px 24px;
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.sts-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(33, 150, 243, 0.35);
}

.sts-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.sts-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: #9e9e9e;
}

/* Privacy Checkbox */
.sts-privacy-row {
    margin-bottom: 18px !important;
}

.sts-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: normal !important;
    font-size: 13px !important;
    cursor: pointer;
    line-height: 1.5;
}

.sts-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #2196f3;
}

.sts-checkbox-label span {
    color: #424242;
}

.sts-checkbox-label a {
    color: #2196f3;
    text-decoration: none;
}

.sts-checkbox-label a:hover {
    text-decoration: underline;
}

.sts-checkbox-label .required {
    color: #d32f2f;
}

.sts-btn {
    display: inline-block;
    padding: 6px 14px;
    background: #2196f3;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

.sts-btn:hover {
    background: #1976d2;
    color: #fff;
}

.sts-btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

/* Messages/Notices */
.sts-form-message {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 13px;
    display: none;
}

.sts-form-message.success {
    display: block;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.sts-form-message.error {
    display: block;
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.sts-notice {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 13px;
}

.sts-notice-info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.sts-notice-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.sts-notice a {
    color: inherit;
    font-weight: 600;
}

/* My Tickets Table */
.sts-my-tickets {
    margin-top: 16px;
    margin-bottom: 16px;
    max-width: 800px;
}

.sts-no-tickets {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 6px;
    color: #666;
    font-size: 14px;
}

.sts-tickets-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-size: 13px;
}

.sts-tickets-table th,
.sts-tickets-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.sts-tickets-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #212121;
    font-size: 12px;
}

.sts-tickets-table tr:last-child td {
    border-bottom: none;
}

.sts-tickets-table tr:hover td {
    background: #fafafa;
}

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

.sts-status-open {
    background: #e3f2fd;
    color: #1565c0;
}

.sts-status-in_progress {
    background: #fff3e0;
    color: #ef6c00;
}

.sts-status-resolved {
    background: #e8f5e9;
    color: #2e7d32;
}

.sts-status-closed {
    background: #eceff1;
    color: #546e7a;
}

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

.sts-priority-low {
    background: #e8f5e9;
    color: #2e7d32;
}

.sts-priority-normal {
    background: #e3f2fd;
    color: #1565c0;
}

.sts-priority-high {
    background: #fff3e0;
    color: #ef6c00;
}

.sts-priority-urgent {
    background: #ffebee;
    color: #c62828;
}

/* Category Label */
.sts-category {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: #f3e5f5;
    color: #7b1fa2;
}

/* Customer Ticket View */
.sts-customer-ticket-view {
    max-width: 700px;
}

.sts-ticket-header {
    margin-bottom: 18px;
}

.sts-back-link {
    display: inline-block;
    margin-bottom: 10px;
    color: #2196f3;
    text-decoration: none;
    font-size: 13px;
}

.sts-back-link:hover {
    text-decoration: underline;
}

.sts-ticket-header h2 {
    margin: 0 0 10px 0;
    color: #212121;
    font-size: 18px;
}

.sts-ticket-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Conversation */
.sts-conversation {
    margin-bottom: 20px;
}

.sts-message {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.sts-message-customer {
    flex-direction: row;
}

.sts-message-admin {
    flex-direction: row-reverse;
}

.sts-message-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
}

.sts-message-avatar img {
    border-radius: 50%;
    width: 36px;
    height: 36px;
}

.sts-message-avatar .dashicons {
    width: 36px;
    height: 36px;
    font-size: 20px;
    color: #4caf50;
    background: #e8f5e9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 36px;
}

.sts-message-content-wrap {
    flex: 1;
    max-width: calc(100% - 50px);
}

.sts-message-customer .sts-message-content-wrap {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px 6px 6px 0;
    padding: 12px;
}

.sts-message-admin .sts-message-content-wrap {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 6px 6px 0 6px;
    padding: 12px;
}

.sts-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.sts-message-header strong {
    color: #212121;
    font-size: 13px;
}

.sts-message-date {
    color: #757575;
    font-size: 11px;
}

.sts-message-content {
    line-height: 1.5;
    color: #424242;
    font-size: 13px;
}

.sts-message-content p:last-child {
    margin-bottom: 0;
}

/* Message Attachments */
.sts-message-attachments {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(0,0,0,0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sts-attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    color: #2196f3;
    text-decoration: none;
    font-size: 12px;
    transition: background 0.2s;
}

.sts-attachment-item:hover {
    background: #f5f5f5;
}

.sts-attachment-item .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.sts-attachment-item small {
    color: #999;
    font-size: 11px;
}

/* Customer Reply Form */
.sts-customer-reply-form {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px;
}

.sts-customer-reply-form h3 {
    margin: 0 0 12px 0;
    color: #212121;
    font-size: 14px;
}

.sts-customer-reply-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.sts-customer-reply-form textarea:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.15);
}

/* Loading Spinner */
.sts-loading {
    position: relative;
    pointer-events: none;
}

.sts-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: sts-spin 0.8s linear infinite;
}

@keyframes sts-spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media screen and (max-width: 600px) {
    .sts-form {
        padding: 16px;
    }
    
    .sts-form-row-half {
        flex-direction: column;
        gap: 0;
    }
    
    .sts-form-col {
        margin-bottom: 14px;
    }
    
    .sts-tickets-table {
        font-size: 12px;
    }
    
    .sts-tickets-table th,
    .sts-tickets-table td {
        padding: 8px;
    }
    
    .sts-message {
        flex-direction: column !important;
    }
    
    .sts-message-avatar {
        display: none;
    }
    
    .sts-message-content-wrap {
        max-width: 100%;
    }
    
    .sts-message-customer .sts-message-content-wrap,
    .sts-message-admin .sts-message-content-wrap {
        border-radius: 6px;
    }
    
    .sts-customer-ticket-view {
        max-width: 100%;
    }
    
    .sts-ticket-header h2 {
        font-size: 16px;
    }
}
