/* Estilos para el frontend del plugin Customer Support Pro */

/* === ESTILOS GENERALES === */
.csp-frontend {
    font-family: inherit;
    line-height: 1.6;
    --csp-primary: var(--wp--preset--color--primary, #2271b1);
    --csp-primary-dark: var(--wp--preset--color--primary-700, #005a87);
    --csp-success: var(--wp--preset--color--green, #46b450);
    --csp-border: var(--wp--preset--color--light-gray, #e1e1e1);
    --csp-bg-light: var(--wp--preset--color--gray-50, #f8f9fa);
    --csp-text: var(--wp--preset--color--neutral-900, #23282d);
    --csp-muted: var(--wp--preset--color--neutral-600, #666);
}

.csp-frontend * {
    box-sizing: border-box;
}

.csp-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* === LISTA DE TICKETS === */
.csp-tickets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--csp-border);
}

.csp-tickets-header h2 {
    margin: 0;
    color: var(--csp-text);
    font-size: 28px;
}

.csp-new-ticket-btn {
    background: var(--csp-primary);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.csp-new-ticket-btn:hover {
    background: var(--csp-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34,113,177,0.3);
}

.csp-new-ticket-btn:before {
    content: '+';
    font-size: 20px;
    font-weight: bold;
}

/* === TARJETAS DE TICKETS === */
.csp-tickets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.csp-ticket-card {
    background: white;
    border: 1px solid var(--csp-border);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.csp-ticket-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: var(--csp-primary);
}

.csp-ticket-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--csp-primary);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.csp-ticket-card:hover:before {
    transform: scaleY(1);
}

.csp-ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.csp-ticket-id {
    background: var(--csp-bg-light);
    color: var(--csp-muted);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.csp-ticket-status {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.csp-ticket-status.open {
    background: #e3f2fd;
    color: #1976d2;
}

.csp-ticket-status.pending {
    background: #fff3e0;
    color: #f57c00;
}

.csp-ticket-status.resolved {
    background: #e8f5e8;
    color: #388e3c;
}

.csp-ticket-status.closed {
    background: #f5f5f5;
    color: #616161;
}

.csp-ticket-subject {
    font-size: 18px;
    font-weight: 600;
    color: var(--csp-text);
    margin-bottom: 10px;
    line-height: 1.4;
}

.csp-ticket-excerpt {
    color: var(--csp-muted);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.csp-ticket-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #888;
}

.csp-ticket-priority {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.csp-ticket-priority.low {
    background: #e8f5e8;
    color: #388e3c;
}

.csp-ticket-priority.medium {
    background: #fff3e0;
    color: #f57c00;
}

.csp-ticket-priority.high {
    background: #ffebee;
    color: #d32f2f;
}

.csp-ticket-priority.urgent {
    background: #d32f2f;
    color: white;
    animation: pulse 2s infinite;
}

/* === VISTA DETALLE DE TICKET === */
.csp-ticket-detail {
    background: white;
    border: none;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 30px;
}

.csp-ticket-detail-header {
    background: linear-gradient(135deg, var(--csp-primary) 0%, var(--csp-primary-dark) 100%);
    color: white;
    padding: 25px;
}

.csp-ticket-detail-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 15px 0;
}

.csp-ticket-detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    font-size: 14px;
}

.csp-meta-item {
    display: flex;
    flex-direction: column;
}

.csp-meta-label {
    opacity: 0.8;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.csp-meta-value {
    font-weight: 600;
}

/* === CONVERSACIÓN === */
.csp-conversation {
    padding: 25px;
}

.csp-conversation-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--csp-text);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--csp-border);
}

.csp-message {
    margin-bottom: 25px;
    position: relative;
}

.csp-message:last-child {
    margin-bottom: 0;
}

.csp-message-bubble {
    background: var(--csp-bg-light);
    border-radius: 12px;
    padding: 18px;
    position: relative;
    max-width: 85%;
}

.csp-message.customer .csp-message-bubble {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.csp-message.support .csp-message-bubble {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.csp-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
}

.csp-message-author {
    font-weight: 600;
    color: var(--csp-text);
}

.csp-message-date {
    color: var(--csp-muted);
    font-size: 13px;
}

.csp-message-content {
    color: var(--csp-text);
    line-height: 1.6;
}

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

/* === FORMULARIO DE RESPUESTA === */
.csp-response-form {
    background: var(--csp-bg-light);
    padding: 25px;
    border-top: 1px solid var(--csp-border);
}

.csp-response-form h3 {
    margin: 0 0 20px 0;
    color: var(--csp-text);
    font-size: 20px;
}

.csp-form-group {
    margin-bottom: 20px;
}

.csp-form-group label {
    display: block;
    font-weight: 600;
    color: var(--csp-text);
    margin-bottom: 8px;
}

.csp-form-group textarea,
.csp-form-group input[type="text"],
.csp-form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--csp-border);
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.csp-form-group textarea:focus,
.csp-form-group input[type="text"]:focus,
.csp-form-group select:focus {
    outline: none;
    border-color: var(--csp-primary);
    box-shadow: 0 0 0 3px rgba(34,113,177,0.1);
}

.csp-form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.csp-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
}

.csp-submit-btn {
    background: var(--csp-primary);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.csp-submit-btn:hover {
    background: var(--csp-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34,113,177,0.3);
}

.csp-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* === MODAL NUEVO TICKET === */
.csp-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.csp-modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.csp-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.csp-modal-header {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.csp-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.csp-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.csp-modal-close:hover {
    background-color: rgba(255,255,255,0.2);
}

.csp-modal-body {
    padding: 25px;
}

/* === FORMULARIO NUEVO TICKET === */
.csp-new-ticket-form .csp-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.csp-new-ticket-form .csp-form-row.full-width {
    grid-template-columns: 1fr;
}

/* === ARCHIVOS ADJUNTOS === */
.csp-file-upload {
    border: 2px dashed #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.csp-file-upload:hover {
    border-color: #0073aa;
    background-color: #f8f9fa;
}

.csp-file-upload.dragover {
    border-color: #0073aa;
    background-color: #e3f2fd;
}

.csp-file-upload-icon {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 10px;
}

.csp-file-upload-text {
    color: #666;
    font-size: 16px;
    margin-bottom: 5px;
}

.csp-file-upload-hint {
    color: #999;
    font-size: 14px;
}

.csp-file-list {
    margin-top: 15px;
}

.csp-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: #f8f9fa;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    margin-bottom: 8px;
}

.csp-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.csp-file-icon {
    width: 24px;
    height: 24px;
    background: #0073aa;
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.csp-file-name {
    font-weight: 600;
    color: #23282d;
}

.csp-file-size {
    color: #666;
    font-size: 14px;
}

.csp-file-remove {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s ease;
}

.csp-file-remove:hover {
    background: #c82333;
}

/* === ESTADOS VACÍOS === */
.csp-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.csp-empty-icon {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 20px;
}

.csp-empty-title {
    font-size: 24px;
    font-weight: 600;
    color: #23282d;
    margin-bottom: 10px;
}

.csp-empty-text {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 25px;
}

/* === NOTIFICACIONES === */
.csp-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100001;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 400px;
}

.csp-notification.show {
    transform: translateX(0);
}

.csp-notification.success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.csp-notification.error {
    background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%);
}

.csp-notification.warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffca2c 100%);
    color: #23282d;
}

/* === LOADING STATES === */
.csp-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.csp-loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.csp-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .csp-container {
        padding: 0 15px;
    }
    
    .csp-tickets-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .csp-tickets-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .csp-ticket-detail-meta {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .csp-message-bubble {
        max-width: 95%;
    }
    
    .csp-new-ticket-form .csp-form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .csp-form-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .csp-modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .csp-modal-header,
    .csp-modal-body {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .csp-ticket-card {
        padding: 15px;
    }
    
    .csp-ticket-subject {
        font-size: 16px;
    }
    
    .csp-ticket-detail-header {
        padding: 20px;
    }
    
    .csp-ticket-detail-title {
        font-size: 20px;
    }
    
    .csp-conversation,
    .csp-response-form {
        padding: 20px;
    }
    
    .csp-message-bubble {
        padding: 15px;
    }
}

/* === UTILIDADES === */
.csp-text-center {
    text-align: center;
}

.csp-text-right {
    text-align: right;
}

.csp-mb-0 {
    margin-bottom: 0;
}

.csp-mb-10 {
    margin-bottom: 10px;
}

.csp-mb-20 {
    margin-bottom: 20px;
}

.csp-mt-20 {
    margin-top: 20px;
}

.csp-hidden {
    display: none !important;
}

.csp-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;
}

/* === ANIMACIONES === */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.csp-fade-in {
    animation: fadeIn 0.3s ease;
}

.csp-slide-up {
    animation: slideUp 0.3s ease;
}

/* === ACCESIBILIDAD === */
.csp-ticket-card:focus,
.csp-new-ticket-btn:focus,
.csp-submit-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

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