/**
 * Advanced Gift Wrapping & Personalization Module - Front CSS
 *
 * @author    PrestaShop Developer
 * @copyright 2026 PrestaShop Developer
 * @license   http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
 */

.agw-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #2563eb;
    font-size: 0.75rem;
    font-weight: bold;
    font-style: italic;
    border: none;
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
    transition: all 0.2s ease-in-out;
}

.agw-info-icon:hover {
    background: #2563eb;
    color: #ffffff;
    transform: scale(1.1);
}

.agw-container {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    font-family: inherit;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.agw-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    border-bottom: 2px solid #f1f3f5;
    padding-bottom: 12px;
}

.agw-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #212529;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
}

.agw-grid {
    display: grid;
    gap: 14px;
}

.agw-grid.agw-layout-grid {
    grid-template-columns: repeat(2, 1fr);
}

.agw-grid.agw-layout-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.agw-grid.agw-layout-list .agw-card {
    width: 100%;
}

.agw-card {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 16px;
    transition: all 0.25s ease-in-out;
    position: relative;
    background: #fff;
    cursor: pointer;

    display: flex;
    flex-direction: column;
}

.agw-card:hover {
    border-color: #2563eb;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.12);
    transform: translateY(-2px);
}

.agw-card.selected {
    border-color: #2563eb;
    background: #f0f7ff;
}

.agw-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.agw-card-img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.agw-card-info {
    flex: 1;
}

.agw-card-name {
    font-weight: 600;
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 4px;
}

.agw-card-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: #2563eb;
}

.agw-tax-label {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
    margin-left: 3px;
    display: inline-block;
}

.agw-card-desc {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 8px;
    line-height: 1.4;
}

.agw-card-body {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #cbd5e1;
    display: none;
    flex-direction: column;
    gap: 12px;
}

.agw-card.expanded .agw-card-body,
.agw-card.selected .agw-card-body {
    display: flex;
}

.agw-card.expanded {
    border-color: #93c5fd;
    box-shadow: 0 0 0 1px #93c5fd;
}

.agw-qty-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.agw-qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.agw-qty-btn:hover {
    background: #e2e8f0;
}

.agw-qty-input {
    width: 48px;
    text-align: center;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px;
    font-weight: 600;
}

.agw-message-box {
    width: 100%;
}

.agw-textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 70px;
}

.agw-char-count {
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: right;
    margin-top: 4px;
}

.agw-btn-preview {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #059669;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.agw-btn-preview:hover {
    background: #047857;
}

/* Modal Live Preview Styling */
.agw-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.agw-modal-content {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 520px;
    padding: 28px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: agwPopIn 0.3s ease-out;
}

@keyframes agwPopIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.agw-preview-card-frame {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 2px dashed #f59e0b;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 2px 10px rgba(245, 158, 11, 0.1);
}

.agw-preview-text {
    font-family: 'Georgia', serif;
    font-style: italic;
    font-size: 1.15rem;
    color: #78350f;
    line-height: 1.6;
    word-break: break-word;
}

.agw-summary-bar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
    gap: 8px;
    flex-wrap: wrap;
}

/* Responsive: narrow sidebar columns */
@media (max-width: 768px) {
    .agw-container {
        padding: 12px;
    }
    .agw-title {
        font-size: 0.95rem;
    }
    .agw-grid.agw-layout-grid {
        grid-template-columns: 1fr;
    }
}

/* Product checklist in front cart (matching reference Screenshot 3) */
.agw-products-box {
    margin: 14px 0 14px 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.agw-products-header {
    background: #f8fafc;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.6px;
    border-bottom: 1px solid #e2e8f0;
    text-transform: uppercase;
}

.agw-products-list {
    display: flex;
    flex-direction: column;
}

.agw-product-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
    transition: background 0.15s ease;
    gap: 12px;
}

.agw-product-row:last-child {
    border-bottom: none;
}

.agw-product-row.selected {
    background: #f8fafc;
}

.agw-product-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    cursor: pointer;
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    user-select: none;
}

.agw-product-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
    accent-color: #2563eb;
}

.agw-product-name {
    line-height: 1.3;
}

.agw-product-attr {
    color: #64748b;
    font-size: 12px;
    font-weight: 400;
    margin-left: 4px;
}

.agw-prod-qty-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.agw-prod-qty-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-right: 4px;
    text-transform: uppercase;
}

.agw-prod-qty-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: #334155;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all 0.15s ease;
}

.agw-prod-qty-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.agw-prod-qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f8fafc;
}

.agw-prod-qty-input {
    width: 32px;
    height: 24px;
    text-align: center;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    background: #f8fafc;
    padding: 0;
}

.agw-msg-header {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================
   Selector rows (tipografía / fondo)
   ============================================================ */
.agw-selector-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.agw-selector-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    min-width: 70px;
}

/* --- Font selector pills --- */
.agw-font-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.agw-font-btn {
    padding: 4px 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    font-size: 0.85rem;
    cursor: pointer;
    color: #334155;
    transition: all 0.18s ease;
    line-height: 1.4;
}

.agw-font-btn:hover {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
}

.agw-font-btn.active {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
}

/* --- Background selector swatches --- */
.agw-bg-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.agw-bg-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1.5px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    font-size: 0.8rem;
    cursor: pointer;
    color: #334155;
    transition: all 0.18s ease;
}

.agw-bg-btn:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

.agw-bg-btn.active {
    border-color: #2563eb;
    background: #eff6ff;
    font-weight: 700;
    color: #1d4ed8;
}

.agw-bg-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.agw-bg-kraft  { background: linear-gradient(135deg, #fef3c7, #fbbf24); }
.agw-bg-ivory  { background: linear-gradient(135deg, #faf9f6, #d6cfc4); }
.agw-bg-night  { background: linear-gradient(135deg, #1e293b, #0f172a); }

/* ============================================================
   Live mini-preview card (inside the card body)
   ============================================================ */
.agw-live-preview-card {
    border-radius: 10px;
    padding: 16px 20px;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 4px 0 8px 0;
    border: 1.5px dashed #e2e8f0;
    transition: background 0.3s ease, border-color 0.3s ease;
}

/* Background themes on the live card */
.agw-live-preview-card.agw-bg-kraft {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #f59e0b;
}

.agw-live-preview-card.agw-bg-ivory {
    background: linear-gradient(135deg, #faf9f6 0%, #f0ebe3 100%);
    border-color: #c4b49a;
}

.agw-live-preview-card.agw-bg-night {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: #334155;
}

.agw-live-preview-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #92400e;
    margin-bottom: 8px;
    opacity: 0.7;
}

.agw-live-preview-text {
    font-size: 1rem;
    color: #78350f;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
    min-height: 1.4em;
    transition: font-family 0.2s ease, color 0.3s ease;
}

/* Font classes applied to .agw-live-preview-text and modal .agw-preview-text */
.agw-font-elegant, #agw-modal-msg-text.agw-font-elegant {
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
}

.agw-font-fun, #agw-modal-msg-text.agw-font-fun {
    font-family: 'Pacifico', cursive;
    font-style: normal;
}

.agw-font-classic, #agw-modal-msg-text.agw-font-classic {
    font-family: 'Lato', sans-serif;
    font-style: normal;
    font-weight: 400;
}

/* ============================================================
   Message footer: char count + preview button
   ============================================================ */
.agw-msg-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    flex-wrap: wrap;
    gap: 6px;
}

/* ============================================================
   Preview button
   ============================================================ */
.agw-btn-preview {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #7c3aed;
    color: #ffffff;
    border: none;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    white-space: nowrap;
}

.agw-btn-preview:hover {
    background: #6d28d9;
    transform: translateY(-1px);
}

/* ============================================================
   Modal — backdrop & frame
   ============================================================ */
.agw-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    display: none; /* hidden by default, shown via JS */
}

.agw-modal-content {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 520px;
    padding: 28px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: agwPopIn 0.3s ease-out;
}

@keyframes agwPopIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

/* Modal card frame — background themes */
.agw-preview-card-frame {
    border-radius: 12px;
    padding: 28px 32px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: background 0.3s ease;
}

.agw-preview-card-frame.agw-bg-kraft {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 2px dashed #f59e0b;
    box-shadow: inset 0 2px 10px rgba(245,158,11,0.08);
}

.agw-preview-card-frame.agw-bg-ivory {
    background: linear-gradient(135deg, #faf9f6 0%, #f0ebe3 100%);
    border: 2px dashed #c4b49a;
}

.agw-preview-card-frame.agw-bg-night {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 2px solid #334155;
}

/* Modal preview text */
.agw-preview-text {
    font-size: 1.15rem;
    color: #78350f;
    line-height: 1.7;
    word-break: break-word;
    white-space: pre-wrap;
    transition: font-family 0.2s ease, color 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .agw-container { padding: 12px; }
    .agw-title { font-size: 0.95rem; }
    .agw-grid.agw-layout-grid { grid-template-columns: 1fr; }
    .agw-selector-row { flex-direction: column; align-items: flex-start; }
    .agw-selector-label { min-width: unset; }
}
