/**
 * Frontend Admin styles for Job Support Tickets
 */

/* Reset and base styles */
.jst-frontend-admin-container *,
.jst-frontend-admin-container {
    box-sizing: border-box;
}

.jst-frontend-admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Header */
.jst-admin-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: var(--jst-gradient-header, linear-gradient(135deg, #14a34b, #16a34a));
    border-radius: var(--jst-radius-lg, 12px);
    color: var(--jst-text-light, white);
}

.jst-admin-header h2 {
    margin: 0 0 10px 0;
    font-size: 2.5rem;
    font-weight: 700;
}

.jst-admin-header p {
    margin: 0;
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Stats cards */
.jst-admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.jst-stat-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.jst-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.jst-stat-number {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #212529;
}

.jst-stat-label {
    font-size: 1rem;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.jst-stat-open .jst-stat-number {
    color: #dc3545;
}

.jst-stat-progress .jst-stat-number {
    color: #fd7e14;
}

.jst-stat-closed .jst-stat-number {
    color: #14a34b;
}

/* Filters */
.jst-admin-filters {
    background: #ffffff;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.jst-filter-form {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.jst-filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.jst-filter-group input,
.jst-filter-group select {
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    background: #ffffff;
    transition: all 0.3s ease;
    min-width: 150px;
}

.jst-filter-group input:focus,
.jst-filter-group select:focus {
    outline: none;
    border-color: #14a34b;
    box-shadow: 0 0 0 3px rgba(20, 163, 75, 0.1);
}

/* Buttons */
.jst-btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.jst-btn-primary {
    background: #14a34b;
    color: white;
}

.jst-btn-primary:hover {
    background: #12a349;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(20, 163, 75, 0.3);
}

.jst-btn-secondary {
    background: #6c757d;
    color: white;
}

.jst-btn-secondary:hover {
    background: #5a626a;
    transform: translateY(-2px);
}

.jst-btn-small {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* No tickets message */
.jst-no-tickets {
    text-align: center;
    padding: 60px 40px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.jst-no-tickets h3 {
    margin: 0 0 15px 0;
    font-size: 2rem;
    color: #495057;
}

.jst-no-tickets p {
    margin: 0;
    font-size: 1.1rem;
    color: #6c757d;
}

/* Tickets table */
.jst-tickets-table-container {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.jst-tickets-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.jst-tickets-table th {
    background: #f8f9fa;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #e9ecef;
}

.jst-tickets-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
}

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

.jst-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.jst-user-info strong {
    color: #212529;
}

.jst-user-info small {
    color: #6c757d;
    font-size: 0.85rem;
}

/* Status and priority badges */
.jst-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.jst-status-open {
    background: #dbeafe;
    color: #1e40af;
}

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

.jst-status-pending {
    background: #e0e7ff;
    color: #3730a3;
}

.jst-status-closed {
    background: #d1fae5;
    color: #065f46;
}

.jst-priority {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.jst-priority-low {
    background: #d1fae5;
    color: #065f46;
}

.jst-priority-normal {
    background: #dbeafe;
    color: #1e40af;
}

.jst-priority-high {
    background: #fef3c7;
    color: #92400e;
}

.jst-priority-urgent {
    background: #fee2e2;
    color: #dc2626;
}

/* Pagination */
.jst-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.jst-pagination-link,
.jst-pagination-current {
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.jst-pagination-link {
    background: #ffffff;
    color: #495057;
    border: 2px solid #e9ecef;
}

.jst-pagination-link:hover {
    background: #14a34b;
    color: white;
    border-color: #14a34b;
    transform: translateY(-2px);
}

.jst-pagination-current {
    background: #14a34b;
    color: white;
    border: 2px solid #14a34b;
}

/* Error message */
.jst-error {
    background: #fee2e2;
    color: #dc2626;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #fca5a5;
    margin: 20px 0;
    text-align: center;
    font-weight: 600;
}

/* Responsive design */
@media (max-width: 768px) {
    .jst-frontend-admin-container {
        padding: 15px;
    }
    
    .jst-admin-header h2 {
        font-size: 2rem;
    }
    
    .jst-admin-header p {
        font-size: 1rem;
    }
    
    .jst-admin-stats {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .jst-stat-number {
        font-size: 2.5rem;
    }
    
    .jst-filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .jst-filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .jst-filter-group input,
    .jst-filter-group select {
        min-width: auto;
        width: 100%;
    }
    
    .jst-tickets-table-container {
        overflow-x: auto;
    }
    
    .jst-tickets-table {
        min-width: 800px;
    }
    
    .jst-pagination {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .jst-admin-header {
        padding: 20px;
    }
    
    .jst-admin-header h2 {
        font-size: 1.8rem;
    }
    
    .jst-stat-card {
        padding: 20px;
    }
    
    .jst-stat-number {
        font-size: 2rem;
    }
    
    .jst-admin-filters {
        padding: 20px;
    }
}

/* Modal specific styles for frontend admin */
.jst-frontend-admin-container .jst-modal {
    z-index: 99999;
}

.jst-frontend-admin-container .jst-modal-content {
    max-width: 95vw;
}

/* Ensure ticket details content flows properly in modal */
.jst-admin-ticket-details {
    padding: 0;
    line-height: 1.6;
    min-height: 0;
    overflow: visible;
    text-align: left;
}

/* Override any inherited center alignment for all text content */
.jst-admin-ticket-details *,
.jst-admin-ticket-details p,
.jst-admin-ticket-details div {
    text-align: left;
}

.jst-ticket-actions-top {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    flex-wrap: wrap;
}

.jst-action-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.jst-action-group label {
    font-weight: 600;
    color: #212529;
    margin-bottom: 0;
    white-space: nowrap;
}

.jst-action-group select {
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    background: #ffffff;
    min-width: 120px;
    font-size: 0.95rem;
}

.jst-action-group select:focus {
    outline: none;
    border-color: #14a34b;
    box-shadow: 0 0 0 2px rgba(20, 163, 75, 0.1);
}

.jst-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.jst-info-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    align-items: center;
}

.jst-info-item strong {
    color: #212529;
    min-width: 100px;
    font-weight: 600;
}

.jst-info-item a {
    color: #14a34b;
    text-decoration: none;
}

.jst-info-item a:hover {
    text-decoration: underline;
}

.jst-ticket-content {
    margin: 25px 0;
    padding: 0 20px;
    text-align: left;
}

.jst-ticket-content h4 {
    margin: 0 0 15px 0;
    font-size: 1.4rem;
    color: #212529;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
    text-align: left;
}

.jst-description-content {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
    text-align: left;
}

.jst-ticket-responses {
    padding: 0 20px;
    margin: 25px 0;
}

.jst-ticket-responses h5 {
    margin: 0 0 20px 0;
    font-size: 1.2rem;
    color: #212529;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.jst-response {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.jst-admin-response {
    border-left: 4px solid #14a34b;
}

.jst-user-response {
    border-left: 4px solid #0073aa;
}

.jst-response-header {
    background: #f8f9fa;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    border-bottom: 1px solid #e9ecef;
    flex-wrap: wrap;
}

.jst-response-header strong {
    color: #212529;
}

.jst-admin-badge {
    background: #14a34b;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.jst-response-date {
    margin-left: auto;
    color: #6c757d;
    font-size: 0.85rem;
}

.jst-response-content {
    padding: 20px;
    background: #ffffff;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
    text-align: left;
}

.jst-admin-add-response {
    margin: 25px 20px 0;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.jst-admin-add-response h5 {
    margin: 0 0 15px 0;
    color: #212529;
    font-size: 1.1rem;
}

.jst-admin-add-response textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 15px;
    resize: vertical;
    min-height: 120px;
    background: #ffffff;
    transition: all 0.3s ease;
}

.jst-admin-add-response textarea:focus {
    outline: none;
    border-color: #14a34b;
    box-shadow: 0 0 0 3px rgba(20, 163, 75, 0.1);
}

.jst-response-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.jst-response-actions label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #212529;
    cursor: pointer;
}

.jst-response-actions input[type="checkbox"] {
    margin: 0;
    transform: scale(1.1);
}

/* Notifications */
.jst-admin-notice {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.jst-notice-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.jst-notice-error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.jst-admin-notice p {
    margin: 0;
    flex: 1;
}

.jst-notice-dismiss {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.jst-notice-dismiss:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

/* Loading indicators */
.jst-loading-indicator {
    text-align: center;
    padding: 60px 40px;
    color: #6c757d;
}

.jst-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #14a34b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.jst-updating {
    opacity: 0.6;
    pointer-events: none;
}

/* Loading state for buttons */
.jst-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Smooth transitions */
.jst-stat-number,
.jst-stat-card,
.jst-btn,
.jst-filter-group input,
.jst-filter-group select,
.jst-admin-add-response textarea {
    transition: all 0.3s ease;
}

/* Focus states */
.jst-btn:focus,
.jst-filter-group input:focus,
.jst-filter-group select:focus,
.jst-action-group select:focus,
.jst-admin-add-response textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(20, 163, 75, 0.1);
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .jst-admin-notice,
    .jst-btn,
    .jst-admin-filters,
    .jst-pagination {
        display: none !important;
    }
    
    .jst-frontend-admin-container {
        background: white !important;
        box-shadow: none !important;
    }
    
    .jst-tickets-table {
        font-size: 12px;
    }
}

/* Force left alignment for all text content in modal */
.jst-modal .jst-admin-ticket-details,
.jst-modal .jst-admin-ticket-details *,
.jst-modal .jst-description-content,
.jst-modal .jst-response-content,
.jst-modal .jst-ticket-content,
.jst-modal p,
.jst-modal div,
.jst-modal span {
    text-align: left !important;
}

/* Ensure modal header and centered elements remain centered */
.jst-modal .jst-modal-header,
.jst-modal .jst-loading-indicator,
.jst-modal .jst-error {
    text-align: center !important;
}