* { box-sizing: border-box; }

:root {
    --we-primary: #1a73e8;
    --we-primary-light: #4285f4;
    --we-dark: #202124;
    --we-light: #f8f9fa;
    --we-text: #5f6368;
    --we-white: #fff;
    --we-border: #dadce0;
    --we-success: #34a853;
}

#wellescom-estimate-app,
.wellcoms-estimate-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Malgun Gothic", sans-serif;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.estimate-header { display: none; }

.estimate-container {
    display: block;
    width: 100%;
}

.estimate-parts-panel,
.estimate-summary-panel {
    background: var(--we-white);
    border-radius: 8px;
    margin-bottom: 16px;
}

.panel-header {
    background: var(--we-primary);
    padding: 12px 16px;
    border-radius: 8px 8px 0 0;
}

.panel-header h2 {
    color: var(--we-white);
    font-size: 16px;
    margin: 0;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px;
    border-bottom: 1px solid var(--we-border);
}

.category-tab {
    padding: 6px 12px;
    border: 1px solid var(--we-border);
    background: var(--we-white);
    border-radius: 16px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.category-tab:hover { border-color: var(--we-primary); color: var(--we-primary); }
.category-tab.active { background: var(--we-primary); border-color: var(--we-primary); color: var(--we-white); }

.search-box {
    display: flex;
    gap: 6px;
    padding: 10px;
    border-bottom: 1px solid var(--we-border);
}

.search-box input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--we-border);
    border-radius: 6px;
    font-size: 13px;
}

.search-box button {
    padding: 8px 14px;
    background: var(--we-light);
    border: 1px solid var(--we-border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--we-border);
    background: var(--we-light);
    font-size: 12px;
}

.filter-controls label { color: var(--we-text); }

.sort-select, .brand-filter {
    padding: 6px 10px;
    border: 1px solid var(--we-border);
    border-radius: 4px;
    font-size: 12px;
    background: var(--we-white);
}

.parts-list-container {
    padding: 10px;
}

.parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.part-card {
    border: 1px solid var(--we-border);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.part-card:hover { border-color: var(--we-primary); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

.part-card-img {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--we-light);
    border-radius: 4px;
    margin-bottom: 8px;
}

.part-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; }

.part-card-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--we-dark);
    line-height: 1.4;
    height: 34px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 6px;
}

.part-card-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--we-primary);
    margin-bottom: 8px;
}

.part-card-actions {
    display: flex;
    gap: 4px;
}

.part-card-actions button {
    flex: 1;
    padding: 6px;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 500;
}

.btn-add { background: var(--we-primary); color: var(--we-white); }
.btn-add:hover { background: var(--we-primary-light); }
.btn-detail { background: var(--we-light); color: var(--we-text); }
.btn-detail:hover { background: var(--we-border); }

.part-card-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--we-primary);
    color: var(--we-white);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

.parts-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 12px;
    border-top: 1px solid var(--we-border);
}

.page-info { font-size: 12px; color: var(--we-text); margin-right: 8px; }

.page-btn {
    padding: 4px 10px;
    border: 1px solid var(--we-border);
    background: var(--we-white);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.page-btn:hover, .page-btn.active { background: var(--we-primary); border-color: var(--we-primary); color: var(--we-white); }

.selected-parts {
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
    border-bottom: 1px solid var(--we-border);
}

.empty-message { text-align: center; color: var(--we-text); padding: 12px; font-size: 13px; }

.selected-part-item {
    display: flex;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--we-border);
    font-size: 11px;
    gap: 6px;
}

.selected-part-item:last-child { border-bottom: none; }

.selected-part-info { flex: 1; min-width: 0; }
.selected-part-category { font-size: 10px; color: var(--we-text); }
.selected-part-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.selected-part-qty { display: flex; align-items: center; gap: 2px; }

.qty-btn {
    width: 20px;
    height: 20px;
    border: 1px solid var(--we-border);
    background: var(--we-white);
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.qty-btn:hover { background: var(--we-primary); color: var(--we-white); border-color: var(--we-primary); }
.qty-value { min-width: 16px; text-align: center; font-weight: 600; }

.selected-part-price { font-weight: 600; min-width: 60px; text-align: right; }

.remove-part {
    background: none;
    border: none;
    color: var(--we-text);
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
}

.remove-part:hover { color: #dc3545; }

.price-summary { padding: 12px; background: var(--we-light); }

.price-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
}

.price-row .label { color: var(--we-text); }
.price-row .value { font-weight: 600; }

.labor-notice {
    margin-top: 8px;
    padding: 6px 10px;
    background: #fff3cd;
    border-radius: 4px;
    font-size: 11px;
    color: #856404;
}

.total-row { padding-top: 8px; border-top: 1px solid var(--we-border); margin-top: 8px; }
.total-row .label { font-weight: 600; }
.total-row .value { font-size: 18px; color: var(--we-primary); }

.action-buttons { padding: 12px; display: flex; flex-wrap: wrap; gap: 6px; }

.btn {
    padding: 10px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--we-primary); color: var(--we-white); }
.btn-primary:hover:not(:disabled) { background: var(--we-primary-light); }
.btn-secondary { background: var(--we-light); color: var(--we-dark); border: 1px solid var(--we-border); }
.btn-accent { background: var(--we-success); color: var(--we-white); }
.btn-accent:hover:not(:disabled) { background: #2d9249; }

.estimate-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.estimate-modal .modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
}

.estimate-modal .modal-content {
    position: relative;
    background: var(--we-white);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
}

.estimate-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--we-border);
    background: var(--we-light);
}

.estimate-modal .modal-header h3 { margin: 0; font-size: 16px; }
.estimate-modal .modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--we-text); }
.estimate-modal .modal-body { padding: 16px; overflow-y: auto; max-height: 60vh; }

.my-estimate-item {
    padding: 10px;
    border: 1px solid var(--we-border);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
}

.my-estimate-item:hover { border-color: var(--we-primary); }
.my-estimate-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.my-estimate-no { font-weight: 600; color: var(--we-primary); font-size: 13px; }
.my-estimate-date { font-size: 11px; color: var(--we-text); }
.my-estimate-price { font-weight: 600; font-size: 14px; }
.no-estimates { text-align: center; padding: 30px; color: var(--we-text); }
.loading { text-align: center; padding: 30px; color: var(--we-text); }

.refresh-section { padding: 10px; text-align: center; border-top: 1px solid var(--we-border); }

@media (max-width: 600px) {
    .parts-grid { grid-template-columns: repeat(2, 1fr); }
    .category-tab { padding: 5px 10px; font-size: 11px; }
    .btn { padding: 8px 10px; font-size: 12px; }
}

.my-estimates-header { text-align: right; margin-bottom: 10px; }
.btn-delete-all { padding: 6px 12px; background: #dc3545; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 12px; }
.btn-delete-all:hover { background: #c82333; }
.my-estimate-item { display: flex; align-items: center; justify-content: space-between; }
.my-estimate-info { flex: 1; cursor: pointer; }
.my-estimate-header-row { display: flex; justify-content: space-between; }
.btn-delete-estimate { width: 28px; height: 28px; background: #f0f0f0; border: none; border-radius: 50%; cursor: pointer; font-size: 16px; color: #666; flex-shrink: 0; margin-left: 8px; }
.btn-delete-estimate:hover { background: #dc3545; color: #fff; }

/* 필터 패널 스타일 */
.filter-toggle-section {
    padding: 8px 10px;
    border-bottom: 1px solid var(--we-border);
}

.filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--we-light);
    border: 1px solid var(--we-border);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.filter-toggle-btn:hover {
    border-color: var(--we-primary);
    color: var(--we-primary);
}

.filter-toggle-btn.active {
    background: var(--we-primary);
    border-color: var(--we-primary);
    color: var(--we-white);
}

.filter-panel {
    border-bottom: 1px solid var(--we-border);
    background: var(--we-light);
}

.filter-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--we-border);
    background: var(--we-white);
}

.filter-panel-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--we-dark);
}

.filter-reset-btn {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--we-border);
    border-radius: 4px;
    font-size: 11px;
    color: var(--we-text);
    cursor: pointer;
    transition: all 0.15s;
}

.filter-reset-btn:hover {
    border-color: #dc3545;
    color: #dc3545;
}

.filter-panel-body {
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.filter-group {
    margin-bottom: 16px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group-header {
    margin-bottom: 8px;
}

.filter-group-title {
    font-weight: 600;
    font-size: 12px;
    color: var(--we-dark);
}

.filter-group-body {
    /* 필터 내용 스타일 */
}

/* 가격 범위 필터 */
.price-range-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.price-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--we-border);
    border-radius: 4px;
    font-size: 12px;
    width: 100%;
}

.price-input:focus {
    outline: none;
    border-color: var(--we-primary);
}

.price-separator {
    color: var(--we-text);
    font-size: 12px;
}

.price-unit {
    color: var(--we-text);
    font-size: 11px;
}

.price-slider-container {
    position: relative;
    height: 24px;
}

.price-slider {
    position: absolute;
    width: 100%;
    height: 4px;
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    top: 10px;
}

.price-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--we-primary);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.price-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--we-primary);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* 체크박스 필터 목록 */
.filter-checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-checkbox-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--we-white);
    border: 1px solid var(--we-border);
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}

.filter-checkbox-item:hover {
    border-color: var(--we-primary);
}

.filter-checkbox-item.checked {
    background: var(--we-primary);
    border-color: var(--we-primary);
    color: var(--we-white);
}

.filter-checkbox-item input {
    display: none;
}

.filter-loading {
    color: var(--we-text);
    font-size: 11px;
    padding: 8px;
}

/* 필터 패널 푸터 */
.filter-panel-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--we-border);
    background: var(--we-white);
}

.btn-filter-apply {
    width: 100%;
    padding: 8px;
    font-size: 12px;
}

/* 속성 필터 그룹 */
.attribute-filter-group {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--we-border);
}

.attribute-filter-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.attribute-filter-title {
    font-weight: 600;
    font-size: 12px;
    color: var(--we-dark);
    margin-bottom: 8px;
}

/* 반응형 */
@media (max-width: 600px) {
    .price-inputs {
        flex-wrap: wrap;
    }
    .price-input {
        min-width: 80px;
    }
    .filter-checkbox-item {
        font-size: 10px;
        padding: 3px 6px;
    }
}

