/**
 * Frontend Styles for TBP Soporte
 */

/* Status Badges */
.tbp-soporte-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
}

.tbp-soporte-status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
}

.tbp-soporte-status-enviado,
.tbp-soporte-status-badge.tbp-soporte-status-enviado {
    background-color: #e3f2fd;
    color: #1976d2;
}

.tbp-soporte-status-en_revision,
.tbp-soporte-status-badge.tbp-soporte-status-en_revision {
    background-color: #fff3e0;
    color: #f57c00;
}

.tbp-soporte-status-esperando_cliente,
.tbp-soporte-status-badge.tbp-soporte-status-esperando_cliente {
    background-color: #ede7f6;
    color: #5e35b1;
}

.tbp-soporte-status-solucionado,
.tbp-soporte-status-badge.tbp-soporte-status-solucionado {
    background-color: #e8f5e9;
    color: #388e3c;
}

/* My Account Ticket List Table styling */
.tbp-soporte-table th {
    background-color: #f9f9f9;
    color: #333;
}

.tbp-soporte-table td {
    vertical-align: middle !important;
}

/* Detail view container */
.tbp-soporte-ticket-detail-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.tbp-soporte-ticket-header {
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.tbp-soporte-ticket-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.tbp-soporte-ticket-title-row h3 {
    margin: 0;
    font-size: 1.4em;
    color: #222;
}

.tbp-soporte-ticket-meta-info {
    margin-top: 10px;
    font-size: 0.9em;
    color: #777;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

/* Conversational Chat Box */
.tbp-soporte-chat-box {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Messages */
.tbp-soporte-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.45;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tbp-soporte-message-client {
    align-self: flex-start;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-top-left-radius: 2px;
}

.tbp-soporte-message-staff {
    align-self: flex-end;
    background-color: #0073aa;
    color: #ffffff;
    border-top-right-radius: 2px;
}

.tbp-soporte-message-staff a {
    color: #ffffff;
    text-decoration: underline;
}

.tbp-soporte-message-author {
    font-size: 0.78em;
    font-weight: 700;
    margin-bottom: 5px;
    opacity: 0.85;
}

.tbp-soporte-message-content {
    font-size: 0.95em;
    word-break: break-word;
}

.tbp-soporte-message-content p {
    margin-bottom: 0;
}

.tbp-soporte-message-content p:not(:last-child) {
    margin-bottom: 10px;
}

.tbp-soporte-message-time {
    font-size: 0.7em;
    text-align: right;
    margin-top: 5px;
    opacity: 0.7;
}

.tbp-soporte-message-attachments {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0,0,0,0.1);
    font-size: 0.85em;
}

.tbp-soporte-message-staff .tbp-soporte-message-attachments {
    border-top-color: rgba(255,255,255,0.2);
}

.tbp-soporte-message-attachments ul {
    margin: 5px 0 0 15px;
    padding: 0;
}

/* Internal notes (Used in backend primarily) */
.tbp-soporte-message-internal-note {
    align-self: center;
    background-color: #fff9db;
    border: 1px solid #ffe066;
    color: #664d03;
    max-width: 90%;
    border-radius: 8px;
}

/* Reply Form */
.tbp-soporte-reply-form-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
}

.tbp-soporte-reply-form-container textarea {
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 12px;
    font-size: 0.95em;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.tbp-soporte-reply-form-container textarea:focus {
    border-color: #0073aa;
}

.tbp-soporte-reply-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 15px;
}

.tbp-soporte-file-upload label {
    cursor: pointer;
    background: #f0f0f0 !important;
    color: #444 !important;
    border: 1px solid #ccc !important;
    padding: 6px 12px !important;
    border-radius: 4px;
    font-size: 0.85em;
    display: inline-block;
    transition: background 0.2s;
}

.tbp-soporte-file-upload label:hover {
    background: #e2e2e2 !important;
}

/* Modal Popup Styles */
.tbp-soporte-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.tbp-soporte-modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 550px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: tbpSoporteModalSlideIn 0.3s ease-out;
}

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

.tbp-soporte-modal-header {
    background: #0073aa;
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tbp-soporte-modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 1.2em;
}

.tbp-soporte-modal-close {
    font-size: 1.5em;
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.tbp-soporte-modal-close:hover {
    opacity: 1;
}

.tbp-soporte-modal-content form {
    padding: 20px;
}

.tbp-soporte-field {
    margin-bottom: 15px;
}

.tbp-soporte-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9em;
    color: #444;
}

.tbp-soporte-field input[type="text"],
.tbp-soporte-field select,
.tbp-soporte-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 0.95em;
}

.tbp-soporte-field textarea {
    resize: vertical;
}

.tbp-file-label {
    display: inline-block;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.88em;
    transition: background 0.2s;
}

.tbp-file-label:hover {
    background: #e5e5e5;
}

.tbp-soporte-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.tbp-soporte-modal-cancel {
    background: #f0f0f0 !important;
    color: #333 !important;
    border: 1px solid #ccc !important;
}

.tbp-soporte-modal-cancel:hover {
    background: #e2e2e2 !important;
}

/* ========================================================
   ORDER LOOKUP FRONTEND (AJAX & MODAL)
   ======================================================== */
.tbp-order-lookup-wrapper {
    margin: 30px 0;
    padding: 25px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid #f1f5f9;
}
.tbp-lookup-header h3 {
    margin: 0 0 5px 0;
    color: #0f172a;
    font-size: 20px;
}
.tbp-lookup-header p {
    color: #64748b;
    margin: 0 0 20px 0;
    font-size: 14px;
}
.tbp-lookup-search-box {
    position: relative;
    max-width: 600px;
}
#tbp-order-lookup-input {
    width: 100%;
    padding: 15px 45px 15px 20px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 50px;
    outline: none;
    transition: all 0.3s ease;
}
#tbp-order-lookup-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.tbp-lookup-spinner {
    position: absolute;
    right: 20px;
    top: 18px;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: tbp-spin 1s linear infinite;
}
@keyframes tbp-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.tbp-lookup-results-container {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
    margin-top: 10px;
    z-index: 100;
    overflow: hidden;
}
.tbp-lookup-result-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.2s;
}
.tbp-lookup-result-item:last-child {
    border-bottom: none;
}
.tbp-lookup-result-item:hover {
    background: #f8fafc;
}
.tbp-lookup-result-item strong {
    color: #1e293b;
    font-size: 15px;
}
.tbp-lookup-result-item small {
    display: block;
    color: #64748b;
    margin-top: 4px;
}

/* Order Modal Glassmorphism */
.tbp-order-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tbp-order-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.tbp-order-modal-content {
    position: relative;
    background: #ffffff;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.3s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
.tbp-order-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border-radius: 16px 16px 0 0;
}
.tbp-order-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #0f172a;
}
.tbp-order-modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}
.tbp-order-modal-close:hover {
    color: #ef4444;
}
.tbp-order-modal-body {
    padding: 25px;
    overflow-y: auto;
    color: #334155;
    font-size: 14px;
}
.tbp-order-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.tbp-order-modal-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
}
.tbp-order-modal-card h4 {
    margin: 0 0 10px 0;
    font-size: 15px;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 5px;
}
.tbp-order-modal-card p {
    margin: 0 0 8px 0;
}
@media (max-width: 600px) {
    .tbp-order-modal-grid { grid-template-columns: 1fr; }
}
