/**
 * AG Catalog & Quote - Frontend CSS v1.0.3
 * Mínimo 100 unidades, formulario profesional 2 columnas.
 */

.ag-cq-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    color: #333;
}

/* === TOOLBAR === */
.ag-cq-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.ag-cq-search-box {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 8px 15px;
    width: 300px;
    max-width: 100%;
}

.ag-cq-search-icon {
    margin-right: 8px;
    font-size: 16px;
}

.ag-cq-search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    width: 100%;
}

.ag-cq-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ag-cq-sort-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

.ag-cq-price-filter {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ag-cq-price-input {
    width: 80px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
}

/* === CONTENT: SIDEBAR + GRID === */
.ag-cq-content {
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

/* === SIDEBAR === */
.ag-cq-sidebar {
    width: 220px;
    min-width: 220px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    position: sticky;
    top: 20px;
    overflow: hidden;
}

.ag-cq-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 18px;
    border-bottom: 1px solid #eee;
}

.ag-cq-sidebar-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
}

.ag-cq-cat-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    max-height: 500px;
    overflow-y: auto;
}

.ag-cq-cat-list li button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 18px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #444;
    text-align: left;
    transition: all 0.2s;
}

.ag-cq-cat-list li button:hover {
    background: #f8f9fa;
    color: #6c2bd9;
}

.ag-cq-cat-list li.active button {
    background: #6c2bd9;
    color: #fff;
    font-weight: 600;
}

.ag-cq-cat-count {
    font-size: 12px;
    opacity: 0.7;
    font-weight: 400;
}

/* === GRID AREA === */
.ag-cq-grid-area {
    flex: 1;
    min-width: 0;
}

.ag-cq-results-info {
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.ag-cq-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* === PRODUCT CARD === */
.ag-cq-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.ag-cq-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.ag-cq-card-image {
    position: relative;
    padding-top: 100%;
    background: #f5f5f5;
    overflow: hidden;
}

.ag-cq-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ag-cq-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #6c2bd9;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.ag-cq-card-badge.out {
    background: #ef4444;
}

.ag-cq-card-body {
    padding: 12px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ag-cq-card-category {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.ag-cq-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    margin: 0 0 6px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ag-cq-card-sku {
    font-size: 11px;
    color: #999;
    margin-bottom: 8px;
}

.ag-cq-card-stock {
    font-size: 12px;
    margin-bottom: 8px;
}

.ag-cq-card-stock.in { color: #16a34a; }
.ag-cq-card-stock.low { color: #f59e0b; }
.ag-cq-card-stock.out { color: #ef4444; }

.ag-cq-card-colors {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.ag-cq-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #ddd;
    cursor: pointer;
}

.ag-cq-card-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: #6c2bd9;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
    margin-top: auto;
}

.ag-cq-card-btn:hover {
    background: #5a1dbd;
}

.ag-cq-card-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* === PAGINATION === */
.ag-cq-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.ag-cq-pagination button {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.ag-cq-pagination button:hover {
    background: #6c2bd9;
    color: #fff;
    border-color: #6c2bd9;
}

.ag-cq-pagination button.active {
    background: #6c2bd9;
    color: #fff;
    border-color: #6c2bd9;
}

.ag-cq-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* === QUOTE PANEL (esquina superior derecha) === */
.ag-cq-quote-panel {
    position: fixed;
    right: 20px;
    top: 80px;
    z-index: 9999;
}

.ag-cq-quote-toggle {
    width: 50px;
    height: 50px;
    background: #6c2bd9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(108,43,217,0.4);
    position: relative;
    transition: transform 0.2s;
}

.ag-cq-quote-toggle:hover {
    transform: scale(1.1);
}

.ag-cq-quote-icon {
    font-size: 22px;
}

.ag-cq-quote-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.ag-cq-quote-content {
    display: none;
    position: absolute;
    top: 60px;
    right: 0;
    width: 340px;
    max-height: 500px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    overflow: hidden;
    flex-direction: column;
}

.ag-cq-quote-content.open {
    display: flex;
}

.ag-cq-quote-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.ag-cq-quote-header h3 {
    margin: 0;
    font-size: 15px;
    color: #333;
}

.ag-cq-quote-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.ag-cq-quote-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px 16px;
    max-height: 300px;
}

.ag-cq-quote-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.ag-cq-quote-item-info h4 {
    margin: 0 0 3px 0;
    font-size: 13px;
    color: #333;
}

.ag-cq-quote-item-info span {
    font-size: 11px;
    color: #888;
}

.ag-cq-quote-item-remove {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
}

.ag-cq-quote-empty {
    text-align: center;
    color: #999;
    padding: 30px 0;
    font-size: 14px;
}

.ag-cq-quote-actions {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid #eee;
}

/* === MODAL === */
.ag-cq-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ag-cq-modal-overlay.open {
    display: flex;
}

.ag-cq-modal {
    background: #fff;
    border-radius: 16px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    display: flex;
}

.ag-cq-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: #333;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* === GALERÍA CON MINIATURAS === */
.ag-cq-modal-gallery {
    width: 45%;
    background: #f5f5f5;
    border-radius: 16px 0 0 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ag-cq-modal-main-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    min-height: 300px;
}

.ag-cq-modal-main-image img {
    max-width: 100%;
    max-height: 350px;
    object-fit: contain;
}

.ag-cq-modal-thumbnails {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    overflow-x: auto;
    background: #fff;
    border-top: 1px solid #eee;
}

.ag-cq-modal-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.ag-cq-modal-thumbnails::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.ag-cq-thumbnail {
    width: 56px;
    height: 56px;
    min-width: 56px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    background: #f5f5f5;
}

.ag-cq-thumbnail:hover {
    border-color: #6c2bd9;
}

.ag-cq-thumbnail.active {
    border-color: #6c2bd9;
}

.ag-cq-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* === DETALLES DEL PRODUCTO === */
.ag-cq-modal-details {
    flex: 1;
    padding: 25px 20px;
}

.ag-cq-modal-category {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.ag-cq-modal-details h2 {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: #222;
    line-height: 1.3;
}

.ag-cq-modal-sku {
    font-size: 13px;
    color: #999;
    margin-bottom: 8px;
}

.ag-cq-modal-stock {
    font-size: 13px;
    margin-bottom: 15px;
}

.ag-cq-modal-stock.in { color: #16a34a; }
.ag-cq-modal-stock.out { color: #ef4444; }

/* Color options */
.ag-cq-color-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.ag-cq-color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 6px 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: all 0.2s;
}

.ag-cq-color-option:hover {
    border-color: #6c2bd9;
}

.ag-cq-color-option.selected {
    border-color: #6c2bd9;
    background: #f3e8ff;
}

.ag-cq-color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #ddd;
}

.ag-cq-color-option span {
    font-size: 10px;
    color: #666;
}

/* Quantity */
.ag-cq-modal-quantity {
    margin: 18px 0;
}

.ag-cq-modal-quantity label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.ag-cq-qty-control {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    width: fit-content;
}

.ag-cq-qty-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ag-cq-qty-btn:hover {
    background: #e5e7eb;
}

.ag-cq-qty-input {
    width: 70px;
    height: 40px;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

/* Warning */
.ag-cq-qty-warning {
    display: none;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 8px 12px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    font-size: 13px;
    color: #92400e;
}

.ag-cq-qty-warning.show {
    display: flex;
}

.ag-cq-warning-icon {
    font-size: 16px;
}

/* === FORMULARIO DE ENVÍO PROFESIONAL === */
.ag-cq-send-modal {
    max-width: 560px;
    padding: 0;
    display: block;
}

.ag-cq-send-header {
    background: linear-gradient(135deg, #6c2bd9 0%, #8b5cf6 100%);
    padding: 28px 30px;
    color: #fff;
    border-radius: 16px 16px 0 0;
}

.ag-cq-send-header h2 {
    margin: 0 0 6px 0;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.ag-cq-send-subtitle {
    margin: 0;
    font-size: 14px;
    color: rgba(255,255,255,0.85);
    line-height: 1.5;
}

/* Resumen de cotización */
.ag-cq-quote-summary {
    padding: 16px 30px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.ag-cq-quote-summary h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ag-cq-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.ag-cq-summary-item:last-child {
    border-bottom: none;
}

.ag-cq-summary-item .item-name {
    color: #333;
    font-weight: 500;
}

.ag-cq-summary-item .item-details {
    color: #888;
    font-size: 12px;
}

.ag-cq-summary-item .item-qty {
    font-weight: 600;
    color: #6c2bd9;
}

/* Form sections */
.ag-cq-send-modal form {
    padding: 24px 30px;
}

.ag-cq-form-section {
    margin-bottom: 20px;
}

.ag-cq-form-section h3 {
    margin: 0 0 14px 0;
    font-size: 15px;
    font-weight: 700;
    color: #333;
    padding-bottom: 8px;
    border-bottom: 2px solid #6c2bd9;
    display: inline-block;
}

.ag-cq-form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 0;
}

.ag-cq-form-half {
    flex: 1;
    min-width: 0;
}

.ag-cq-form-full {
    width: 100%;
}

.ag-cq-form-group {
    margin-bottom: 14px;
}

.ag-cq-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}

.ag-cq-field-icon {
    margin-right: 4px;
    font-size: 14px;
}

.ag-cq-required {
    color: #ef4444;
    font-weight: 400;
}

.ag-cq-form-group input,
.ag-cq-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafafa;
}

.ag-cq-form-group input:focus,
.ag-cq-form-group textarea:focus {
    outline: none;
    border-color: #6c2bd9;
    box-shadow: 0 0 0 3px rgba(108,43,217,0.1);
    background: #fff;
}

.ag-cq-form-group input::placeholder,
.ag-cq-form-group textarea::placeholder {
    color: #aaa;
}

/* Submit button */
.ag-cq-btn-submit {
    margin-top: 10px;
    margin-bottom: 12px;
    padding: 16px;
    font-size: 16px;
    background: linear-gradient(135deg, #6c2bd9 0%, #8b5cf6 100%);
    position: relative;
}

.ag-cq-btn-submit:hover {
    background: linear-gradient(135deg, #5a1dbd 0%, #7c3aed 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(108,43,217,0.3);
}

/* Privacy */
.ag-cq-form-privacy {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin: 0;
}

/* Success */
.ag-cq-send-success {
    text-align: center;
    padding: 50px 30px;
}

.ag-cq-success-check {
    width: 80px;
    height: 80px;
    background: #f0fdf4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    animation: ag-cq-popIn 0.4s ease;
}

@keyframes ag-cq-popIn {
    0% { transform: scale(0); }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.ag-cq-send-success h3 {
    margin: 0 0 8px 0;
    color: #222;
    font-size: 22px;
}

.ag-cq-send-success p {
    color: #666;
    margin: 0;
    font-size: 15px;
}

/* Buttons */
.ag-cq-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.ag-cq-btn-primary {
    background: #6c2bd9;
    color: #fff;
}

.ag-cq-btn-primary:hover {
    background: #5a1dbd;
}

.ag-cq-btn-outline {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
}

.ag-cq-btn-outline:hover {
    border-color: #999;
    color: #333;
}

.ag-cq-btn-full {
    width: 100%;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .ag-cq-content {
        flex-direction: column;
    }
    .ag-cq-sidebar {
        width: 100%;
        min-width: auto;
        position: static;
    }
    .ag-cq-cat-list {
        max-height: 200px;
    }
    .ag-cq-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
    .ag-cq-modal {
        flex-direction: column;
    }
    .ag-cq-modal-gallery {
        width: 100%;
        border-radius: 16px 16px 0 0;
    }
    .ag-cq-modal-main-image {
        min-height: 250px;
    }
    .ag-cq-quote-content {
        width: 300px;
        right: -10px;
    }
    .ag-cq-send-modal form {
        padding: 20px;
    }
    .ag-cq-form-row {
        flex-direction: column;
        gap: 0;
    }
}

@media (max-width: 480px) {
    .ag-cq-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .ag-cq-search-box {
        width: 100%;
    }
    .ag-cq-toolbar-right {
        justify-content: space-between;
    }
    .ag-cq-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .ag-cq-price-filter {
        display: none;
    }
    .ag-cq-quote-panel {
        right: 10px;
        top: 70px;
    }
    .ag-cq-send-header {
        padding: 20px;
    }
    .ag-cq-quote-summary {
        padding: 12px 20px;
    }
}

/* === LOADING === */
.ag-cq-loading {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.ag-cq-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top-color: #6c2bd9;
    border-radius: 50%;
    animation: ag-cq-spin 0.8s linear infinite;
}

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