.quick-replies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 25px 30px;
}
.quick-reply-card {
    background: rgba(30, 34, 45, 0.45);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}
.quick-reply-card:hover {
    transform: translateY(-3px);
    background: rgba(42, 48, 66, 0.6);
    border-color: var(--wb-accent-blue);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.quick-reply-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.quick-reply-shortcut-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--wb-text-light);
    letter-spacing: 0.5px;
}
.quick-reply-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.badge-compatibility {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
}
.badge-compatibility.whatsapp_mobile {
    background: rgba(52, 195, 143, 0.15);
    color: #34c38f;
    border: 1px solid rgba(52, 195, 143, 0.2);
}
.badge-compatibility.crm_only {
    background: rgba(85, 110, 230, 0.15);
    color: #556ee6;
    border: 1px solid rgba(85, 110, 230, 0.2);
}
.badge-scope {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
}
.badge-scope.global {
    background: rgba(241, 180, 76, 0.15);
    color: #f1b44c;
    border: 1px solid rgba(241, 180, 76, 0.2);
}
.badge-scope.personal {
    background: rgba(116, 120, 141, 0.15);
    color: #a6b0cf;
    border: 1px solid rgba(116, 120, 141, 0.2);
}
.quick-reply-card-body {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    color: #eff2f7;
    line-height: 1.5;
    margin-bottom: 15px;
    min-height: 70px;
    max-height: 110px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.quick-reply-card-body::-webkit-scrollbar {
    width: 4px;
}
.quick-reply-card-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
}
.quick-reply-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 12px;
    margin-top: auto;
}
.quick-reply-meta {
    font-size: 11px;
    color: var(--wb-text-muted);
}
.quick-reply-actions {
    display: flex;
    gap: 10px;
}
.btn-action-qr {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 13px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.btn-action-qr.edit {
    color: var(--wb-text-muted);
}
.btn-action-qr.edit:hover {
    color: var(--wb-accent-blue);
    background: rgba(85, 110, 230, 0.1);
}
.btn-action-qr.delete {
    color: var(--wb-text-muted);
}
.btn-action-qr.delete:hover {
    color: var(--wb-status-red);
    background: rgba(244, 106, 106, 0.1);
}
.compatibility-card:has(input:checked) {
    border-color: var(--wb-accent-blue) !important;
    background: rgba(85, 110, 230, 0.08) !important;
}
.preset-gallery-card:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(85, 110, 230, 0.25) !important;
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.08) !important;
    border-color: var(--wb-accent-blue) !important;
}

/* Styles for Quick Reply Attachments UI */
.qr-attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
}
.qr-attachment-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}
.qr-attachment-name {
    color: var(--wb-text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}
.qr-attachment-type {
    font-size: 10px;
    color: var(--wb-text-muted);
    background: rgba(0, 0, 0, 0.2);
    padding: 1px 5px;
    border-radius: 4px;
    text-transform: uppercase;
}
.btn-remove-attachment {
    background: transparent;
    border: none;
    color: var(--wb-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}
.btn-remove-attachment:hover {
    color: var(--wb-status-red);
    background: rgba(244, 106, 106, 0.1);
}

/* Library Selector item */
.library-selector-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.library-selector-item:hover {
    background: rgba(85, 110, 230, 0.08);
    border-color: var(--wb-accent-blue);
}

/* Chat autocomplete attachments preview bar styling */
.wbc-pending-attachments-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(30, 34, 45, 0.85);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 15px;
    width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
}
.wbc-pending-attachment-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 4px 10px;
    border-radius: 6px;
    flex-shrink: 0;
    max-width: 180px;
}
.wbc-pending-attachment-preview span {
    font-size: 11px;
    color: var(--wb-text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wbc-pending-attachment-preview i {
    font-size: 12px;
}
.wbc-pending-attachment-remove {
    background: transparent;
    border: none;
    color: var(--wb-text-muted);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wbc-pending-attachment-remove:hover {
    color: var(--wb-status-red);
}

/* --- MODAL DE CREACIÓN / EDICIÓN --- */

/* Modal Backdrop */
#modal-quick-reply.wb-modal,
#modal-presets-gallery.wb-modal,
#modal-library-selector.wb-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 12, 18, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

/* Modal Content Box */
#modal-quick-reply .wb-modal-content,
#modal-presets-gallery .wb-modal-content,
#modal-library-selector .wb-modal-content {
    background: #171923; /* Darker tailored background */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    width: 100%;
    max-width: 520px;
    overflow: hidden;
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Header */
.wb-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.01);
}

.wb-modal-header h3 {
    margin: 0;
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.wb-modal-header .close-modal {
    color: rgba(255, 255, 255, 0.4);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
}

.wb-modal-header .close-modal:hover {
    color: #ffffff;
    transform: scale(1.1);
}

/* Form Padding */
#wbc-quick-reply-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Form Groups & Inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.25);
    color: #ffffff;
    font-size: 13.5px;
    line-height: 1.5;
    transition: all 0.2s ease;
}

.form-group input[type="text"]::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    border-color: #556ee6;
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 0 0 3px rgba(85, 110, 230, 0.2);
    outline: none;
}

.form-group small {
    color: rgba(255, 255, 255, 0.35);
    font-size: 11px;
    line-height: 1.4;
}

/* Shortcut specific input prefix styles */
.shortcut-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.shortcut-input-wrapper span {
    position: absolute;
    left: 14px;
    color: #556ee6;
    font-weight: 700;
    font-size: 16px;
    pointer-events: none;
}

.shortcut-input-wrapper input {
    padding-left: 32px !important;
}

/* Tabs styles */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.15);
    padding: 6px 20px 0 20px;
    gap: 6px;
}

.modal-tab-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    outline: none;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.modal-tab-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.02);
}

.modal-tab-btn.active {
    color: #556ee6;
    border-bottom-color: #556ee6;
    background: rgba(85, 110, 230, 0.05);
}

.modal-tab-btn #modal-tab-attachments-count {
    font-size: 10px;
    background: rgba(85, 110, 230, 0.2);
    color: #7f95fc;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
    margin-left: 2px;
}

.modal-tab-content {
    display: none;
    flex-direction: column;
    gap: 20px;
    animation: fadeInTab 0.25s ease;
}

.modal-tab-content.active {
    display: flex;
}

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

/* Compatibility Cards Grid */
.compatibility-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 4px;
}

.compatibility-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
    padding: 14px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s ease;
}

.compatibility-card:hover {
    border-color: rgba(85, 110, 230, 0.3) !important;
    background: rgba(255, 255, 255, 0.02) !important;
    transform: translateY(-1px);
}

.compatibility-card.active {
    border-color: #556ee6 !important;
    background: rgba(85, 110, 230, 0.08) !important;
    box-shadow: 0 4px 15px rgba(85, 110, 230, 0.15);
}

.compatibility-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 12.5px;
    color: #ffffff;
}

.compatibility-card-title input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.compatibility-card-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.35;
    padding-left: 20px;
}

/* Toggle Switch Row */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 10px;
    margin-top: 4px;
}

.toggle-row.global-row {
    background: rgba(85, 110, 230, 0.04);
    border: 1px solid rgba(85, 110, 230, 0.12);
}

.toggle-row.ai-row {
    background: rgba(241, 180, 76, 0.04);
    border: 1px solid rgba(241, 180, 76, 0.12);
}

.toggle-row-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 80%;
}

.toggle-row-title {
    font-size: 12.5px;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toggle-row-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.35;
}

/* Custom switch overrides */
.wb-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
    flex-shrink: 0;
}

.wb-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.wb-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.12);
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.wb-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: #a6b0cf;
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.wb-switch input:checked + .wb-slider {
    background-color: #556ee6;
}

.wb-switch input:checked + .wb-slider:before {
    transform: translateX(20px);
    background-color: #ffffff;
}

.wb-slider.round {
    border-radius: 34px;
}

.wb-slider.round:before {
    border-radius: 50%;
}

/* Attachments Panel inside Tab */
.attachments-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 16px;
    border-radius: 12px;
}

/* Actions Grid inside Attachments */
.attachments-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 6px;
}

.attachments-actions-grid .btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.attachments-actions-grid .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: #556ee6 !important;
    transform: translateY(-1px);
}

/* Footer of modal */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 16px 24px 20px 24px;
    background: rgba(255, 255, 255, 0.01);
}

.modal-footer .btn-text {
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
    font-size: 13px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-footer .btn-text:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.03);
}

.modal-footer .btn-primary {
    background: #556ee6;
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    border: none;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(85, 110, 230, 0.3);
    transition: all 0.2s ease;
}

.modal-footer .btn-primary:hover {
    background: #4458ce;
    box-shadow: 0 6px 20px rgba(85, 110, 230, 0.45);
    transform: translateY(-1px);
}
