/* material-quotes.css - E-Commerce Style */

/* Catalog Layout */
.catalog-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.catalog-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.catalog-search-wrap {
    position: relative;
    width: 300px;
}
.catalog-search-wrap i {
    position: absolute;
    left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--gray-400); font-size: 18px;
}
.catalog-search-wrap input {
    width: 100%; padding: 10px 12px 10px 36px;
    border: 1px solid var(--gray-300); border-radius: 8px;
    font-size: 14px; transition: all 0.2s; background: var(--gray-50);
}
.catalog-search-wrap input:focus {
    background: #fff; border-color: var(--primary); outline: none;
    box-shadow: 0 0 0 3px rgba(44, 62, 143, 0.1);
}

.mat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    padding: 24px;
}

.mat-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.mat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 32px rgba(0,0,0,0.08);
    border-color: var(--gray-300);
}

.mat-card-img-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    background: var(--gray-50);
    overflow: hidden;
}

.mat-card-img-wrapper img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.mat-card:hover .mat-card-img-wrapper img {
    transform: scale(1.05);
}

.mat-card-placeholder {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: var(--gray-300); font-size: 48px;
}

.mat-card-body {
    padding: 20px;
    display: flex; flex-direction: column; flex: 1;
}

.mat-card-cat {
    font-size: 12px; color: var(--gray-500); margin-bottom: 6px; font-weight: 600;
}

.mat-card-title {
    font-size: 16px; font-weight: 700; color: var(--gray-900); margin: 0 0 12px 0;
    line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.mat-card-meta {
    font-size: 12px; color: var(--gray-500); margin-bottom: 12px; display: flex; gap: 8px;
}

.mat-card-price {
    margin-top: auto; font-size: 20px; font-weight: 800; color: var(--primary);
    display: flex; align-items: baseline; gap: 4px;
}
.mat-card-price small { font-size: 12px; color: var(--gray-500); font-weight: 600; }

.empty-state {
    text-align: center; padding: 60px 20px; color: var(--gray-400); font-size: 15px;
    grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center;
}
.empty-state i { font-size: 64px; color: var(--gray-300); margin-bottom: 16px; }

/* PDP (Product Detail Page) Overlay Modal */
.pdp-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: all 0.3s ease; backdrop-filter: blur(4px);
}
.pdp-overlay.active { opacity: 1; visibility: visible; }

.pdp-content {
    background: #fff; width: 95vw; max-width: 1300px; height: 92vh;
    border-radius: 16px; box-shadow: 0 24px 48px rgba(0,0,0,0.2);
    display: flex; flex-direction: column; overflow: hidden;
    transform: scale(0.95) translateY(20px); transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
}
.pdp-overlay.active .pdp-content { transform: scale(1) translateY(0); }

.pdp-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px; border-bottom: 1px solid var(--gray-200); background: #fff;
}
.pdp-header h2 { margin: 0; font-size: 18px; font-weight: 700; color: var(--gray-800); }
.pdp-close { background: none; border: none; font-size: 28px; cursor: pointer; color: var(--gray-400); transition: color 0.2s; }
.pdp-close:hover { color: var(--gray-900); }
.pdp-header-actions { display: flex; gap: 10px; align-items: center; }

.pdp-body {
    display: flex; flex: 1; overflow: hidden;
}

/* Left Gallery */
.pdp-gallery-col {
    width: 45%; background: #f8fafc; padding: 40px; border-right: 1px solid var(--gray-200);
    overflow-y: auto; display: flex; flex-direction: column;
}

.pdp-main-img {
    width: 100%; aspect-ratio: 1; border-radius: 16px; background: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06); object-fit: cover;
    margin-bottom: 24px; cursor: zoom-in; border: 1px solid var(--gray-200);
}
.pdp-main-img-placeholder {
    width: 100%; aspect-ratio: 1; border-radius: 16px; background: #fff;
    border: 1px dashed var(--gray-300); display: flex; align-items: center; justify-content: center;
    font-size: 80px; color: var(--gray-200); margin-bottom: 24px;
}

.pdp-thumb-list { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.pdp-thumb-list img {
    width: 80px; height: 80px; border-radius: 10px; object-fit: cover;
    cursor: pointer; border: 2px solid transparent; transition: all 0.2s; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.pdp-thumb-list img:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.pdp-thumb-list img.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(44, 62, 143, 0.2); }

/* Right Info */
.pdp-info-col {
    flex: 1; padding: 40px; overflow-y: auto; background: #fff;
}

.pdp-cat { display: inline-block; padding: 4px 10px; background: var(--gray-100); color: var(--gray-700); font-size: 13px; font-weight: 600; border-radius: 6px; margin-bottom: 16px; }
.pdp-title { font-size: 32px; font-weight: 800; color: var(--gray-900); margin: 0 0 24px 0; line-height: 1.3; }

.pdp-remarks {
    background: #f8fafc; padding: 20px; border-radius: 12px; border: 1px solid var(--gray-100);
    font-size: 14px; color: var(--gray-700); margin-bottom: 40px; line-height: 1.6; white-space: pre-wrap;
}

.pdp-section-title { font-size: 20px; font-weight: 700; color: var(--gray-900); margin: 0 0 20px 0; display: flex; justify-content: space-between; align-items: center;}

/* Variants Block */
.pdp-variant-block {
    border: 1px solid var(--gray-200); border-radius: 12px; margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02); overflow: hidden; background: #fff;
}
.pdp-variant-header {
    background: #f8fafc; padding: 16px 20px; border-bottom: 1px solid var(--gray-200);
    display: flex; justify-content: space-between; align-items: center;
}
.pdp-variant-title { font-size: 16px; font-weight: 700; color: var(--gray-800); }

.quote-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.quote-table th { background: #fff; color: var(--gray-500); padding: 12px 20px; font-weight: 600; text-align: left; border-bottom: 1px solid var(--gray-100); font-size: 13px;}
.quote-table td { padding: 16px 20px; border-bottom: 1px solid var(--gray-100); color: var(--gray-800); }
.quote-table tr:last-child td { border-bottom: none; }
.quote-table td.col-price { font-weight: 700; font-family: monospace; font-size: 16px; color: var(--gray-900); text-align: right;}
.quote-table td.col-actions { text-align: right; }

.quote-row.lowest-price { background-color: rgba(16, 185, 129, 0.03); }
.badge-crown { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 6px; background: rgba(245, 158, 11, 0.1); color: var(--yellow-600); font-size: 11px; font-weight: 700; margin-left: 8px; border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-selected { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 6px; background: rgba(59, 130, 246, 0.1); color: var(--blue-600); font-size: 11px; font-weight: 700; margin-left: 8px; border: 1px solid rgba(59, 130, 246, 0.2); }

.btn-add-quote-full {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
    padding: 16px; background: #fff; color: var(--primary); font-size: 14px; font-weight: 600;
    border: none; border-top: 1px solid var(--gray-200); cursor: pointer; transition: background 0.2s;
}
.btn-add-quote-full:hover { background: #f8fafc; }

/* Modals (Editing Item/Variant/Quote) */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 2000;
    display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: all 0.2s; backdrop-filter: blur(2px);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content {
    background: #fff; border-radius: 16px; width: 900px; max-width: 95vw;
    box-shadow: 0 24px 48px rgba(0,0,0,0.2); transform: translateY(20px); transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
    display: flex; flex-direction: column; max-height: 90vh;
}
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--gray-100); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { margin: 0; font-size: 18px; font-weight: 700; color: var(--gray-800); }
.modal-close { background: none; border: none; font-size: 24px; color: var(--gray-400); cursor: pointer; transition: color 0.15s; }
.modal-close:hover { color: var(--gray-800); }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-footer { padding: 20px 24px; border-top: 1px solid var(--gray-100); display: flex; justify-content: flex-end; gap: 12px; background: #f8fafc; border-bottom-left-radius: 16px; border-bottom-right-radius: 16px;}

/* Reused grid patterns from previous */
.modal-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.modal-form-grid .fg-full { grid-column: 1 / -1; }
.fg { display: flex; flex-direction: column; gap: 8px; }
.fg label { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.fg input, .fg select, .fg textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 14px; transition: border-color 0.2s; background: #fff; }
.fg input:focus, .fg select:focus, .fg textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(44, 62, 143, 0.1); }
.fg textarea { resize: vertical; min-height: 100px; }

.dropzone { border: 2px dashed var(--gray-300); border-radius: 12px; padding: 40px 20px; text-align: center; color: var(--gray-500); transition: all 0.2s; cursor: pointer; background: #f8fafc; margin-bottom: 12px; }
.dropzone.dragover { border-color: var(--primary); background: #eff6ff; color: var(--primary); }
.dropzone i { font-size: 40px; margin-bottom: 12px; color: var(--gray-400); }
.dropzone.dragover i { color: var(--primary); }

.img-preview-list { display: flex; flex-wrap: wrap; gap: 12px; }
.img-preview-item { position: relative; width: 80px; height: 80px; border-radius: 8px; overflow: hidden; border: 1px solid var(--gray-200); background: #fff; }
.img-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.img-preview-item .btn-remove { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.7); color: #fff; border: none; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 14px; cursor: pointer; transition: background 0.15s; }
.img-preview-item .btn-remove:hover { background: var(--red-500); }

.combo-box-wrapper { position: relative; }
.combo-box-wrapper .combo-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--gray-400); }
.combo-box-wrapper select { position: absolute; right: 0; top: 0; bottom: 0; width: 30px; opacity: 0; cursor: pointer; }

#imgViewerOverlay { z-index: 3000; }
#imgViewerOverlay img { max-width: 90vw; max-height: 90vh; border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,0.4); transition: transform 0.2s; }

/* Mobile Responsive */
@media (max-width: 992px) {
    .pdp-body { flex-direction: column; overflow-y: auto; }
    .pdp-gallery-col { width: 100%; border-right: none; border-bottom: 1px solid var(--gray-200); padding: 24px; overflow-y: visible;}
    .pdp-info-col { width: 100%; padding: 24px; overflow-y: visible;}
    .pdp-main-img { max-width: 500px; margin: 0 auto 16px auto; display: block; }
}
@media (max-width: 768px) {
    .mat-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); padding: 16px; gap: 16px;}
    .catalog-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
    .catalog-search-wrap { width: 100%; }
    .pdp-content { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
    .pdp-header { border-radius: 0; }
    .modal-content { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
    .modal-form-grid { grid-template-columns: 1fr; }
    .quote-table th, .quote-table td { padding: 12px 10px; font-size: 13px;}
}

/* SweetAlert z-index fix */
.swal2-container {
    z-index: 10000 !important;
}
